What you are doing seems very curious and odd to me!
ebessette wrote:
...
@OneToMany(targetEntity = Type.class)
@JoinTable(
name = "locations_types",
joinColumns = @JoinColumn(name = "location_id"),
inverseJoinColumns = @JoinColumn(name = "type_id")
)
@OrderBy(value = "type")
private List<String> types;
@Entity
@Table(name = "types")
public class Type {
@Id
@ManyToOne(targetEntity=Location.class)
private int id;
...
}
[/code]
First, you need not "targetEntity=" - if you would map to a
Code:
private List<Type> types;
,
and on the reverse side to
Code:
private Location loc;
- not to an id (the id is in the database, but not in Java code.
Remember: Hibernate and JPA are working on POJOs; so you just have to code bidirectional relations using Java objects on both sides!
Or, did I misunderstand your effort completely?