[jboss-user] [EJB 3.0] - One-To-One?how to make two tables share their primary key?

killme2008 do-not-reply at jboss.com
Wed Sep 6 00:24:44 EDT 2006


you see,in Hibernate,we can set a pojo to have an one-to-one relationship with the other entity by share their primary key,for example:



  |      <class name="TUser"
  |                table="user"
  |        ......
  |           <one-to-one name="passport"
  |                    class="TPassport"
  |                    cascade="all"
  |                    outer-join="all"
  |            />
  |       </class>
  |   
It is related with TPassport like:
  
  |            <class name="TPassport"
  |                      table="user"
  |             >
  |                    <id name="id" column="id">
  |                     <generator class="foreign">
  |                           <param name="property>user</param>
  |                     </generator>
  |                    </id>
  |                    <one-to-one name="user"
  |                    class="TUser"
  |                    contrained="true" />
  | 
the TPassport's primary key is genearted by TUser's,how to do that in ejb3?I tried many times,but failed.who can give me an example?thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969620#3969620

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969620



More information about the jboss-user mailing list