Monday, 15 July 2013

java - Hibernate eager/lazy load with constraint -



java - Hibernate eager/lazy load with constraint -

classa { @id @generatedvalue @column(name = "a_id") private long id; @onetomany(fetch = fetchtype.lazy, cascade = cascadetype.all, mappedby = "classa") private set<classb> classbs; } classb { @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "a_id") private classa classa; @joincolumn(name = "size") private int size; }

how can add together constraint classa's classbs when eager/lazy load it?

for example, want load classb size > 10 classa's set classbs.

i know can order set using annotation @orderby(value = "size asc"), can add together constraints other order?

can accomplish using hibernate?

i able in laravel(a php framework). eager load constraints in http://laravel.com/docs/eloquent#eager-loading.

have @ hibernate filters: documentation sample there 1 thing should notice , filters not applied entity permanently , need enable them whenever utilize them:

session.enablefilter("myfilter");

java hibernate lazy-loading

No comments:

Post a Comment