3
Hello, I have in my system the following entities Customer, Supplier and Financial. They all have a list of Contacts, as a bi-directional relationship would look in these molds.
public class Client {
@OneToMany
private List<Contact> contacts
}
public class Supplier {
@OneToMany
private List<Contatc> contacts
}
public class Financial {
@OneToMany
private List<Contat> contacts
}
public class Contact {
@ManyToOne
?????????
}
I’m using Hibernate as ORM and Springmvc. Thanks in advance.
EDIT: It would be more or less what I need, I found this example and I will study how to use why I didn’t know, but it seems to solve me the problem.
http://www.javabeat.net/polymorphic-association-mapping-relationship-hibernate/
No need for annotations in the Contact class
– Oscar
I would need it because I need it to be bidirectional understood. At least I think so.
– Rogerio Ferracin