I got classes:
@Entity
@Table(name="users")
public class User{
private Integer id;
private String name;
private Address address;
}
and:
@Entity
@Table(name="adress")
public class Adress{
private Integer id;
private String street;
(...)
}
Any way how to map relation @ManyToOne (many users can have the same adres), BUT I don’t want to have property List< User > users in my Address class?
Add the annotation
@ManyToOneto the address field. Problem solved. For details on how this can be customized, see the Hibernate reference manual. Typically you would use