I am using Hibernate to do mapping. One of my classes have a set of longs. I’d like to set lazy to true when fetching this object. Would it cause problem if I fetch an object and after a while use the set inside it?
I am using Hibernate to do mapping. One of my classes have a set
Share
The
lazyattribute is applicable to child entities. If an entity is child relationship is fetched lazily, then it isn’t fetched from the database until your application tries to access it.lazywouldn’t apply to a ‘set of longs’. I’m not even sure what you mean by that. If you literally have a set of just numbers, I would hack and, write a method to create a String comprised of the longs, and not worry about lazy loading it.Users often run into problems with
lazybecause they try to access a lazy collection after the session is closed. Because hibernate will fetch the relevant objects only when they are accessed, if the session is closed, it’s a problem — this is the dreadedLazyInitializationException.