欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Hibernate集合映射之Bag

系統 2198 0

?數據庫結構:

?

create?table?teamBag?(id?varchar( 32 ),teamname?varchar( 32 ));
create?table?studentBag(id?varchar(
32 ),cardid?varchar( 32 ),name?varchar( 32 ),age? int ,description?varchar( 32 ),?team_id?varchar( 32 ),cid?varchar( 32 ));

?

POJO

?

package ?Collection.Bag;

public ? class ?Student? ... {
??
private ?String?id;
??
private ?String?name;
??
private ?String?description;
??
private ? int ?age;
??
private ?String?cardid;
??
private ?Team?team;
public ?String?getId()? ... {
????
return ?id;
}

public ? void ?setId(String?id)? ... {
????
this .id? = ?id;
}

public ?String?getName()? ... {
????
return ?name;
}

public ? void ?setName(String?name)? ... {
????
this .name? = ?name;
}

public ?String?getDescription()? ... {
????
return ?description;
}

public ? void ?setDescription(String?description)? ... {
????
this .description? = ?description;
}

public ? int ?getAge()? ... {
????
return ?age;
}

public ? void ?setAge( int ?age)? ... {
????
this .age? = ?age;
}

public ?String?getCardid()? ... {
????
return ?cardid;
}

public ? void ?setCardid(String?cardid)? ... {
????
this .cardid? = ?cardid;
}

public ?Team?getTeam()? ... {
????
return ?team;
}

public ? void ?setTeam(Team?team)? ... {
????
this .team? = ?team;
}

}




package ?Collection.Bag;

import ?java.util.ArrayList;
import ?java.util.List;
import ?java.util.Map;

public ? class ?Team? ... {
???
private ?String?id;
???
private ?String?teamname;
???
private ?List?students = new ?ArrayList();
public ?String?getId()? ... {
????
return ?id;
}

public ? void ?setId(String?id)? ... {
????
this .id? = ?id;
}

public ?String?getTeamname()? ... {
????
return ?teamname;
}

public ? void ?setTeamname(String?teamname)? ... {
????
this .teamname? = ?teamname;
}

public ?List?getStudents()? ... {
????
return ?students;
}

public ? void ?setStudents(List?students)? ... {
????
this .students? = ?students;
}


}

?

Student.hbm.xml

?

<? xml?version="1.0"?encoding="utf-8" ?>
<! DOCTYPE?hibernate-mapping?PUBLIC?"-//Hibernate/Hibernate?Mapping?DTD?3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<!-- ?
????Mapping?file?autogenerated?by?MyEclipse?-?Hibernate?Tools
-->
< hibernate-mapping >
< class? name ="Collection.Bag.Student" ?table ="studentBag" ? >
????
< id? name ="id" ?unsaved-value ="null" >
??????
< generator? class ="uuid.hex" ></ generator >
????
</ id >
????
< property? name ="cardid" ?type ="string" ?column ="cardid" ></ property >
????
< property? name ="name" ?type ="string" ?column ="name" ></ property >
????
< property? name ="age" ?type ="int" ?column ="age" ></ property >
????
< property? name ="description" ?type ="string" ?column ="description" ></ property > ?
????
< many-to-one? name ="team" ?
?????????????????column
="team_id"
?????????????????class
="Collection.Bag.Team" ?
?????????????????cascade
="none" ?
?????????????????fetch
="join" >
????
</ many-to-one >
</ class >

</ hibernate-mapping >

?

Team.hbm.xml

?

<? xml?version="1.0"?encoding="utf-8" ?>
<! DOCTYPE?hibernate-mapping?PUBLIC?"-//Hibernate/Hibernate?Mapping?DTD?3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<!-- ?
????Mapping?file?autogenerated?by?MyEclipse?-?Hibernate?Tools
-->
< hibernate-mapping >
< class? name ="Collection.Bag.Team" ?table ="teamBag" ? >
????
< id? name ="id" ?unsaved-value ="null" >
??????
< generator? class ="uuid.hex" ></ generator >
????
</ id >
????
< property? name ="teamname" ?type ="string" ?column ="teamname" ></ property >
??
???? < bag? name ="students" ?table ="studentBag" ?cascade ="all,delete-orphan" ? >

??????
< key? column ="team_id" ></ key >
??????
< one-to-many? class ="Collection.Bag.Student" />
????
</ bag >
</ class >

</ hibernate-mapping >

?

hibernate.cfg.xml

?

<? xml?version='1.0'?encoding='UTF-8' ?>
<! DOCTYPE?hibernate-configuration?PUBLIC
??????????"-//Hibernate/Hibernate?Configuration?DTD?3.0//EN"
??????????"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
>

<!-- ?Generated?by?MyEclipse?Hibernate?Tools.??????????????????? -->
< hibernate-configuration >

< session-factory >
????
< property? name ="connection.username" > root </ property >
????
< property? name ="connection.url" >
????????jdbc:mysql://localhost:3306/schoolproject?characterEncoding=gb2312
&amp; useUnicode=true
????
</ property >
????
< property? name ="dialect" >
????????org.hibernate.dialect.MySQLDialect
????
</ property >
????
< property? name ="myeclipse.connection.profile" > mysql </ property >
????
< property? name ="connection.password" > 1234 </ property >
????
< property? name ="connection.driver_class" >
????????com.mysql.jdbc.Driver
????
</ property >
????
< property? name ="hibernate.dialect" >
????????org.hibernate.dialect.MySQLDialect
????
</ property >
????
< property? name ="hibernate.show_sql" > true </ property >
????
< property? name

Hibernate集合映射之Bag


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 午夜羞羞 | 免费看a | 一区二区中文字幕 | 毛片a区 | 成人精品综合免费视频 | 日韩成人在线电影 | 狠狠躁夜夜躁人人爽天天miya | 看免费的毛片 | 亚洲第一第二区 | 亚洲欧美日韩在线不卡中文 | www.久久久.com | 91精品网 | 日本一区二区三区高清不卡 | 三极片在线观看 | 免费区一级欧美毛片 | 91青青青青青爽在线 | 午夜伦4480yy私人影院 | 国产精品1区2区 | 成人精品视频 成人影院 | www.99av| 欧美一级片在线看 | 亚洲欧美日本在线观看 | 国产精品久久久天天影视香蕉 | 国产亚洲一区二区精品 | 国产视频资源在线观看 | 欧美另类视频一区二区三区 | 性69式视频在线观看免费 | 久草在线资源福利站 | www.亚洲黄色| 久久精品免费一区二区三区 | 国产精品97在线 | 丁香婷婷久久 | 噜噜噜色网 | 久久青草精品免费资源站 | 国产精品久久久久久久久久免费看 | 成年人免费看 | 日韩一区二区不卡 | aaaaa国产毛片 | 欧美专区在线视频 | 天天做天天爱夜夜大爽完整 | 欧美一区二区三区四区夜夜大片 |