[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Lazy Loading of Map key For OneToMany

calidoggg do-not-reply at jboss.com
Tue Sep 25 22:12:08 EDT 2007


Hi,

I am using maps to represent a one-to-many relationship in our entity:

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

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

I am going to be detaching this entity from the J2EE 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.

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

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



More information about the jboss-user mailing list