-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Persist am Map<Integer, Entity>
PostPosted: Wed Nov 28, 2012 6:29 am 
Newbie

Joined: Wed Nov 28, 2012 6:16 am
Posts: 4
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.