0 Replies Latest reply on Mar 13, 2006 6:01 PM by uday dustin

    Primary Key(ID) Propagation into Objects

    uday dustin Newbie

      I have three objects and relationships:


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

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


      Class B:
      @Id(generate = GeneratorType.AUTO)
      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!!!