0 Replies Latest reply on Sep 26, 2007 12:10 PM by Pouyan Azarshahri

    Map lazily loaded.  Are the keys that it is mapping availabl

    Pouyan Azarshahri Newbie

      Hi,

      I am using maps to represent a one-to-many relationship in our entity, using EJB 3.0 along with Java Persistence:



      @OneToMany(cascade = CascadeType.ALL, mappedBy = "patientID")
       private Map<Integer, OrderTable> orderTableCollection;




      This is a snippet of my Patient entity, which has a one to many relationship with my OrderTable entity.

      I am going to be detaching this entity from the J2EE/JBoss server. Since this is a oneToMany relationship the Map is lazily loaded by default (this is the behavior that I want, I DO NOT want to eagerly load it); does this mean the Map might not be instantiated? Or will the Map be instantiated with the proper OrderTable keys but not the corresponding OrderTable entity values?

      Thanks.