Hibtags

JSP 1.2 tag library for Hibernate 2.1

Example 7

Find all cats over 15 pounds and deletes them one by one. The <hib:delete> is not the most efficient tag and could be changed to support both individual and bulk deletes.

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://hibtags.lokitech.com/taglib" prefix="hib" %>

<%-- Open a new session for this page --%>
<hib:session>

<%-- Finds cats over 15 pounds --%>
<hib:find var="fatcats">
  from Cat c
 where c.weight > 15
</hib:find>

<%-- Loops over our fat cats and deletes them one by one --%>
<c:forEach items="${fatcats}" var="fatcat">
  <hib:delete target="${fatcat}" />
</c:forEach>

<%-- Close the current session --%>
</hib:session>

Uses

<hib:delete>

<hib:find>

<hib:session>

Home
Examples
Documentation
Mailing list
Download
About Us
License
CVS
SF page





SourceForge.net Is Down