[jboss-user] [Beginner's Corner] - Persisting java.util.Map with custom class as key and value

piotrekde do-not-reply at jboss.com
Sun Apr 17 13:20:19 EDT 2011


piotrekde [http://community.jboss.org/people/piotrekde] created the discussion

"Persisting java.util.Map with custom class as key and value"

To view the discussion, visit: http://community.jboss.org/message/600487#600487

--------------------------------------------------------------
Hi, I have the following situation:


@Entity
@Table(name = 'myclass_table')
public class MyClass {
  private Map<CustomObjectOne, CustomObjectTwo> map;
  (...)
}
 
public class CustomObjectOne {
 int a;
 int b;
}
 
public class CustomObjectTwo {
  double x;
}



Could you please give me an example how to persist MyClass along with Map inside (using annotations)?

I've found that I can use @ElementCollection annotation in order to do it, but as far as I know it's not available in Java1.5/EJB3.0 which I use.
Thanks in advance!
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/600487#600487]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110417/8da4fa5a/attachment.html 


More information about the jboss-user mailing list