java - Hibernate delete using criteria -


can use criteria delete records tables?

for example,

criteria todelete = session.createcriteria(car.class, "car").createalias("car.wheel", "wheel"); todelete.add(restrictions.eq("brand", "toyota")); todelete.add(restrictions.eq("wheel.brand", "bbs"); todelete.add(restrictions.gt("date_of_purchase", someday); todelete.add(restrictions.between("cost", 3000, 5000); 

how can use todelete criteria delete records interested in? inefficient way query ids using todelete criteria, delete car objects there. also, can know how many objects have deleted?

you should upgrade hibernate version version implements jpa 2.1 (hibernate starts jpa 2.1 on version 4.3.11.final - hibernate downloads)

once have upgraded, can use criteriadelete want. here small example: example


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -