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
Post a Comment