[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to map collection of entity ids

jamestang do-not-reply at jboss.com
Wed May 23 02:04:37 EDT 2007


Let's say Factory.java and Product.java are entity classes.
There is a one-to-many unidirectional relationship from Factory to Product.

  | @Entity
  | public class Factory implements Serializable {
  |     @Id
  |     private Long id;
  | 
  |     // This is a collection of Product ids.  How to map this???
  |     private List<Long> productIds;
  |     ......
  | }
  | 
  | @Entity
  | public class Product implements Serializable {
  | 
  |     @Id
  |     private Long id;
  |     ......
  | }
  | 

My question is: how to write the mapping metadata for Factory.productIds?
(I know List< Long > can't be persisted. But how can JPA solve this simple case?)

TIA.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047789#4047789

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047789



More information about the jboss-user mailing list