Use Hibernate annotations and generated values. This is a very quick example,
and may not work out of the box.
| public class Parent {
|
| @Id
| @GeneratedValue(strategy = GenerationType.SEQUENCE)
| private Long id
|
| @OneToOne
| @PrimaryKeyJoinColumn
| private Child child;
| }
|
| public class Child {
|
| @Id
| @GeneratedValue(generator="foreignKeyGenerator")
| @org.hibernate.annotations.GenericGenerator(name="foreignKeyGenerator",
strategy="foreign",[EMAIL PROTECTED](name="property", value="parent"))
|
| @OneToOne(optional=false)
| @JoinColumn(name="id")
| private Parent parent;
| }
|
HTH
Tim
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124420#4124420
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124420
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user