[jboss-user] [EJB 3.0] - Re: check if a lazy property is loaded

ablevine1 do-not-reply at jboss.com
Tue Jul 11 21:07:05 EDT 2006


I'm not exactly sure how this works for lazy-loadable properties that are non-collection based objects, but I bet it's probably pretty similar.  For properties that are a collection implementation e.g. List, Set, .. etc., their lazy loaded proxy collections implement the interface org.hibernate.collection.PersistentCollection after they are persisted by the entity manager.  To determine if one of these has been loaded yet, you can call the wasInitialized() method.  Most likely, the proxy objects that implement lazy-loaded non-collection based properties implement a common interface and have a method that you can call that is similar to wasInitialized().

I see that there is a org.hibernate.proxy.HibernateProxy interface. Perhaps these objects implement that.  If so, then you may be able to call
getHibernateLazyInitializer() to get a LazyInitializer and then from that call isUninitialized(), how ever I have not yet tried this.

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

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



More information about the jboss-user mailing list