I have three objects and relationships: 

A->B->C. 

I could create a successful true one to one relation between A and B,
below is the code for that

Class A:
    @Id(generator="fk") 
    @GenericGenerator(name="fk", strategy = "foreign", parameters={
         @Parameter(name="property", value="b") 
        })
    @Column(name="ID")
    public long id;

   @OneToOne(cascade=CascadeType.ALL)
   @PrimaryKeyJoinColumn
   
Class B:
    @Id(generate = GeneratorType.AUTO)
    @Column(name="ID")
    public long id;

everthing worked fine using above, 
But  I would like to have "not true" one-to-one relation Between B and C ie 
Class C can exist independtly so I have to use auto key gen for C.
My Question is how to create a One to One relation between B and C

I tried persisting the C class I get an exception 
 "attempted to assign id from null one-to-one property"

I looked in ForeignGenerator.java it takes and requires only one property 
value. and also other classes and documentation but I could not figure out.

Any help on this would be appreciated!!!



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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to