1 Reply Latest reply on Sep 13, 2005 12:34 PM by Emmanuel Bernard

    optional @OneToOne relationship

    Yevgen Bushuyev Newbie

      Hi.
      I have an optional OneToOne relationship between my entities and since it is optional i want to have several records in the underlying table with this relation set to NULL.

       @Entity...
       @Table(name = "A, uniqueConstraints = {})
       public class A {
       @OneToOne(optional = true)
       @JoinColumn(name = "b_id", unique = false, nullable = true)
       private B b;
       }
      


      Despite all my attempts JBoss sets unique constraint on the b_id column which thus prohibits insertion of more that one record with empty b_id.
      I use MS SQL as db, if it matters. Any suggestions?

      wbr, eugen.