0 Replies Latest reply on May 23, 2007 2:04 AM by jamestang

    How to map collection of entity ids

    jamestang

      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.