code_junkie

How to do custom-query based collection mappings in Hibernate?

Nov 13th, 2011
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <set name="ops" inverse="true" cascade="all, delete-orphan">
  2. <key column="cityblock_id" on-delete="cascade"/>
  3. <one-to-many class="com.tamedtornado.data.Operation"/>
  4. </set>
  5.  
  6. from ops where status="active"
  7.  
  8. List activeOperations = sess.createCriteria(Operation.class)
  9. .add( Restrictions.equals("status", "active") )
  10. .list();
Add Comment
Please, Sign In to add comment