0 Replies Latest reply on Nov 23, 2009 9:37 PM by I need a real name

    EntityHome + @OneToOne + {xyzHome.persist}

    I need a real name Newbie
      Hello Community,

      with Eclipse I have created two Entity Beans named A and B.
      The following files are auto generated:





      On the page a.xhtml I can already store data in my MySQL database.
      The a.xhtml calls #{AHome.persist} to do this.

      On the page aList.xhtml I can see my stored data.

      So far so good! :)

      Now I want to bring both entities into a unidirectional OneToOne
      relationship using shared primary keys. So that when #{AHome.persist}
      is called, also a row for the related B entity instance is stored
      in the database.

      I already annotated a method in A.java like this:

      private B b;

      @OneToOne(cascade = CascadeType.ALL)
      public B getB() {
           return b;

      What else do I have to do? Because when calling #{AHome.persist}
      still only a row in the table for AHome is stored in the database
      but no associated row in the table for BHome.

      I searched the online seam examples but found no example
      so I hope to find some help here.

      Thanks a lot!