Hibernate一对多(单向) - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-14
PRIMARY KEY(id)
);
Hibernate一对多(单向)(4)时间:2012-01-03 blogjava 天堂露珠3、映射文件: 用户类映射文件/src/wintys/hibernate/onetomany/User.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 Persistence Tools --> <hibernate-mapping> <class name="wintys.hibernate.onetomany.User" table="myuser" catalog="db"> <id name="id" type="string"> <column name="id" not-null="true"/> <generator class="uuid.hex" /> </id> <property name="name" type="java.lang.String" column="name" /> <set name="cards" inverse="false" cascade="all"> <key column="userId" /> <one-to-many class="wintys.hibernate.onetomany.Card" /> </set> </class> </hibernate-mapping> 银行卡映射文件/src/wintys/hibernate/onetomany/User.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 Persistence Tools --> <hibernate-mapping> <class name="wintys.hibernate.onetomany.Card" table="mycard" catalog="db"> <id name="id" type="string"> <column name="id" not-null="true"/> <generator class="uuid.hex" /> </id> <property name="balance" /> </class> </hibernate-mapping> Hibernate一对多(单向)(5)时间:2012-01-03 blogjava 天堂露珠Hibernate配置文件:/src/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/db?useUnicode=true&characterEncoding=utf-8 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Hibernate一对多(单向) - 编程入门网的所有评论