From: <one...@us...> - 2003-03-08 06:39:42
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv15856/sf/hibernate Modified Files: Hibernate.java Session.java Added Files: Criteria.java Log Message: added new criteria + expression API (experimental) --- NEW FILE: Criteria.java --- //$Id: Criteria.java,v 1.1 2003/03/08 06:31:22 oneovthafew Exp $ package net.sf.hibernate; import java.util.List; import net.sf.hibernate.expression.Expression; /** * <tt>Criteria</tt> is a simplified API for retrieving objects * by composing <tt>Expression</tt> objects. This is a very * convenient approach for functionality like "search" screens * where there is a variable number of conditions to be placed * upon the result set.<br> * <br> * In the current implementation, conditions may only be placed * upon properties of the class being retrieved (and its * components). Hibernate's query language is much more general * and should be used for non-simple cases. * <br> * <i>This is an experimental API</i> */ public interface Criteria { /** * Set a limit upon the number of objects to be retrieved * * @param maxResults * @return Criteria */ public Criteria setMaxResults(int maxResults); /** * Set the first result to be retrieved * * @param firstResult * @return Criteria */ public Criteria setFirstResult(int firstResult); /** * Set a timeout for the underlying JDBC query * * @param timeout * @return Criteria */ public Criteria setTimeout(int timeout); /** * Add an <tt>Expression</tt> to constrain the results * to be retrieved. * * @param expression * @return Criteria */ public Criteria add(Expression expression); /** * Get the results * * @return List * @throws HibernateException */ public List list() throws HibernateException; } Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Hibernate.java 22 Feb 2003 06:42:06 -0000 1.6 --- Hibernate.java 8 Mar 2003 06:31:22 -0000 1.7 *************** *** 262,265 **** --- 262,266 ---- return new ClobImpl(reader, length); } + } Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Session.java 6 Mar 2003 11:12:06 -0000 1.9 --- Session.java 8 Mar 2003 06:31:22 -0000 1.10 *************** *** 8,12 **** import java.util.Iterator; import java.util.List; ! import java.util.Map; /** * The main runtime interface between a Java application and Hibernate. This is the --- 8,12 ---- import java.util.Iterator; import java.util.List; ! /** * The main runtime interface between a Java application and Hibernate. This is the *************** *** 277,291 **** */ public List find(String query) throws HibernateException; ! ! /** ! * Find persistent instances with the given property values ! * ! * @param persistentClass a persistent class ! * @param propertyNameValues property name / value pairs ! * @return List ! * @throws HibernateException ! */ ! //public List find(Class persistentClass, Map propertyNameValues) throws HibernateException; ! /** * Execute a query, binding a value to a "?" parameter in the query string. --- 277,281 ---- */ public List find(String query) throws HibernateException; ! /** * Execute a query, binding a value to a "?" parameter in the query string. *************** *** 475,478 **** --- 465,470 ---- */ public Transaction beginTransaction() throws HibernateException; + + public Criteria createCriteria(Class persistentClass); /** |