Same Entity in Bidirectional OneToOne

By | July 12, 2018
Questions:

I’m trying to find a solution about this problem:
I have a relationship table that map the rules of another entity.

    @Entity
public class Relation {
   @Id
   public Long id;
   @OneToOne
   public Address addressHome;
   @OneToOne
   public Address addressWork
}

and a class Address

@Entity
    public class Address {
       @Id
       public Long id;
    }

I would put a bidirectional relation from Address to relation.

Can someone help me?
Thanks

Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *