jpa - spring data lazy loading -


i use spring data, jpa , hibernate

i have advertisement class

@entity public class advertisement implements serializable {    @id   @generatedvalue(strategy = generationtype.auto)   private long id;    @onetomany(mappedby="id", cascade={cascadetype.remove}, fetch=fetchtype.lazy)   private set<message> messages = new hashset<message>(); } 

and message class

@entity public class message implements serializable {   @id   @generatedvalue(strategy = generationtype.auto)   private long id;   @manytoone(fetch = fetchtype.lazy)   private advertisement advertisement; } 

when search advertisement id, can see message... don't understand why, put lazy...

i search way load advertisement without message.

you not loading messages until call it.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -