Hi, I'm trying to persist a Map<Integer, Entity> but it doesn't really work ...
The scenario: Entity "Event" has a Map from Channel-Number to a Device. The Channel-Number doesnt belong to any entity ... ist just some integer value. The Device is another Entity.
Event and Device is a Many to Many relationship.
Event:
Code:
@Entity
public class Event implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.TABLE)
private int id;
/* @MapKey
@ManyToMany
@JoinTable(
name = "DmxDeviceDao",
joinColumns = @JoinColumn(name = "id"),
inverseJoinColumns = @JoinColumn(name = "idDevice")
)*/
private Map<Integer, Device> channelToDevice;
...
Code:
@Entity
public class DmxDeviceDao implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.TABLE)
private long idDevice;
@Basic
private String name;
@Basic
private String description;
...
As you can see, I have tried some annotation I found in the web but it didnt really worked so far ... and I have actually no idea what to do to make it work.
Thanks for help!