JBoss Community

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

created by piotrekde in Beginner's Corner - View the full discussion

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

Start a new discussion in Beginner's Corner at Community