ϵͳѧϰhibernateÖ®Áù£ºÒ»¶ÔÒ»Íâ¼ü¹ØÁªÓ³ÉäË«Ïò¹ØÁª - ±à³ÌÈëÃÅÍø
ϵͳѧϰhibernateÖ®Áù£ºÒ»¶ÔÒ»Íâ¼ü¹ØÁªÓ³ÉäË«Ïò¹ØÁªÊ±¼ä:2011-08-26hibernateÒ»¶ÔһΨһÍâ¼ü¹ØÁªÓ³É䣨˫Ïò¹ØÁªPerson<---->idcard£© Ò»¶ÔһΨһÍâ¼ü¹ØÁªË«Ïò£¬ÐèÒªÔÚÁíÒ»¶Ë£¨idcard£©£¬Ìí¼Ó<one-to-one>±êÇ©£¬Ö¸Ê¾hibernateÈçºÎ¼ÓÔØ Æä¹ØÁª¶ÔÏó£¬Ä¬Èϸù¾ÝÖ÷¼ü¼ÓÔØperson£¬Íâ¼ü¹ØÁªÓ³ÉäÖУ¬ÒòΪÁ½¸öʵÌå²ÉÓõÄÊÇpersonµÄÍâ¼üά»¤µÄ¹Øϵ£¬ ËùÒÔ²»ÄÜÖ¸¶¨Ö÷¼ü¼ÓÔØperson£¬¶øÒª¸ù¾ÝpersonµÄÍâ¼ü¼ÓÔØ£¬ËùÒÔ²ÉÓÃÈçÏÂÓ³É䷽ʽ£º <one-to-one name="person" property-ref="idCard"/> 1¡¢PersonµÄPOJOÀࣺ 1public class Person {23¡¡¡¡private int id;45¡¡¡¡private String name;67¡¡¡¡private IdCard idCard;8//Ê¡ÂÔsetter¡¢getter·½·¨9} 2¡¢IdCardµÄPOJOÀࣺ 1public class IdCard {23¡¡¡¡private int id;45¡¡¡¡private String cardNo;67¡¡¡¡private Person person;8//Ê¡ÂÔsetter¡¢getter·½·¨9} ϵͳѧϰhibernateÖ®Áù£ºÒ»¶ÔÒ»Íâ¼ü¹ØÁªÓ³ÉäË«Ïò¹ØÁª(2)ʱ¼ä:2011-08-263¡¢PersonµÄÓ³ÉäÎļþPerson.hbm.xml 1<?xml version="1.0"?>2<!DOCTYPE hibernate-mapping PUBLIC3¡¡¡¡"-//Hibernate/Hibernate Mapping DTD 3.0//EN"4¡¡¡¡"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">5<hibernate-mapping>6¡¡¡¡<class name="org.apple.hibernate.Person" table="t_person">7¡¡¡¡¡¡¡¡<id name="id">8¡¡¡¡¡¡¡¡¡¡¡¡<generator class="native"/>9¡¡¡¡¡¡¡¡</id>10¡¡¡¡¡¡¡¡<property name="name"/>11¡¡¡¡¡¡¡¡<many-to-one name="idCard" unique="true"/>12¡¡¡¡</class>13</hibernate-mapping> 4¡¢IdCardµÄÓ³ÉäÎļþIdCard.hbm.xml 1<?xml version="1.0"?>2<!DOCTYPE hibernate-mapping PUBLIC3¡¡¡¡"-//Hibernate/Hibernate Mapping DTD 3.0//EN"4¡¡¡¡"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">5<hibernate-mapping>6¡¡¡¡<class name="org.apple.hibernate.IdCard" table="t_idcard">7¡¡¡¡¡¡¡¡<id name="id">8¡¡¡¡¡¡¡¡¡¡¡¡<generator class="native"/>9¡¡¡¡¡¡¡¡</id>10¡¡¡¡¡¡¡¡<property name="cardNo"/>11¡¡¡¡¡¡¡¡<one-to-one name="person" property-ref="idCard"/>12¡¡¡¡</class>13</hibernate-mapping> |
ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»! |
- vbscriptºÍjavascript°æµÄ15λ, 18λµÄÉí·ÝÖ¤ºÅÂëµÄÑéÖ¤º¯Êý.ÒÔ¼°¸ù¾ÝÉí·Ý֤ȡʡ·Ý,ÉúÈÕ,ÐÔ±ð
- windows2003Îļþ·þÎñÆ÷µÄ°²×°·½·¨(ͼÎĽ̳Ì)
- SpringѧϰµãµÎ£¬¡¶Spring in Action¡·±Ê¼Ç£¨Áù£© - ±à³ÌÈëÃÅÍø
- IE6ʹÓø¡¶¯È¥µôÔªËØÖеĶàÓà¿Õ°×¼ä¾à
- ²ËÄñÉÁ¿Í:ÎÒ½«FlashËزÄ"͵"³öÀ´
- »ùÓÚEclipseµÄǶÈëʽarm-linux¿ª·¢Óëµ÷ÊÔ»·¾³
- ³¬³éÏóͼ±ê -- Area o.42
- LinuxÉÏÁ¬½ÓMicrosoft SQL Server 2005
- Photoshopµ÷ɫʵÀý:ÌðÃÀµÄµ³ÈÉ«µ÷Ä£ÌØÅ®º¢
- Linux°ü¹ÜÀíËÙ²é±í