From: <one...@us...> - 2003-03-04 10:53:49
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv2690/sf/hibernate Modified Files: Query.java Session.java Log Message: made Query methods return this to allow chaining added experimental find(Class, Map) improved parsing of query imports, etc fixed a bug in PS handling Index: Query.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Query.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Query.java 31 Jan 2003 08:49:49 -0000 1.7 --- Query.java 4 Mar 2003 10:53:46 -0000 1.8 *************** *** 111,115 **** * @param maxResults the maximum number of rows */ ! public void setMaxResults(int maxResults); /** * Set the first row to retrieve. If not set, rows will be --- 111,115 ---- * @param maxResults the maximum number of rows */ ! public Query setMaxResults(int maxResults); /** * Set the first row to retrieve. If not set, rows will be *************** *** 119,123 **** * @param firstResult a row number, numbered from <tt>0</tt> */ ! public void setFirstResult(int firstResult); /** --- 119,123 ---- * @param firstResult a row number, numbered from <tt>0</tt> */ ! public Query setFirstResult(int firstResult); /** *************** *** 125,129 **** * @param timeout the timeout in seconds */ ! public void setTimeout(int timeout); /** --- 125,129 ---- * @param timeout the timeout in seconds */ ! public Query setTimeout(int timeout); /** *************** *** 134,138 **** * @param type the Hibernate type */ ! public void setParameter(int position, Object val, Type type); /** * Bind a value to a named query parameter. --- 134,138 ---- * @param type the Hibernate type */ ! public Query setParameter(int position, Object val, Type type); /** * Bind a value to a named query parameter. *************** *** 141,145 **** * @param type the Hibernate type */ ! public void setParameter(String name, Object val, Type type); /** --- 141,145 ---- * @param type the Hibernate type */ ! public Query setParameter(String name, Object val, Type type); /** *************** *** 151,155 **** * @throws net.sf.hibernate.HibernateException if no type could be determined */ ! public void setParameter(int position, Object val) throws HibernateException; /** * Bind a value to a named query parameter, guessing the Hibernate --- 151,155 ---- * @throws net.sf.hibernate.HibernateException if no type could be determined */ ! public Query setParameter(int position, Object val) throws HibernateException; /** * Bind a value to a named query parameter, guessing the Hibernate *************** *** 159,163 **** * @throws net.sf.hibernate.HibernateException if no type could be determined */ ! public void setParameter(String name, Object val) throws HibernateException; /** --- 159,163 ---- * @throws net.sf.hibernate.HibernateException if no type could be determined */ ! public Query setParameter(String name, Object val) throws HibernateException; /** *************** *** 168,172 **** * @param type the Hibernate type of the values */ ! public void setParameterList(String name, Collection vals, Type type) throws HibernateException; /** --- 168,172 ---- * @param type the Hibernate type of the values */ ! public Query setParameterList(String name, Collection vals, Type type) throws HibernateException; /** *************** *** 177,181 **** * @param vals a collection of values to list */ ! public void setParameterList(String name, Collection vals) throws HibernateException; /** --- 177,181 ---- * @param vals a collection of values to list */ ! public Query setParameterList(String name, Collection vals) throws HibernateException; /** *************** *** 185,231 **** * @param bean any JavaBean or POJO */ ! public void setProperties(Object bean) throws HibernateException; ! public void setString(int position, String val); ! public void setCharacter(int position, char val); ! public void setBoolean(int position, boolean val); ! public void setByte(int position, byte val); ! public void setShort(int position, short val); ! public void setInteger(int position, int val); ! public void setLong(int position, long val); ! public void setFloat(int position, float val); ! public void setDouble(int position, double val); ! public void setBinary(int position, byte[] val); ! public void setSerializable(int position, Serializable val); ! public void setLocale(int position, Locale locale); ! public void setBigDecimal(int position, BigDecimal number); ! public void setDate(int position, Date date); ! public void setTime(int position, Date date); ! public void setTimestamp(int position, Date date); ! public void setCalendar(int position, Calendar calendar); ! public void setCalendarDate(int position, Calendar calendar); ! public void setString(String name, String val); ! public void setCharacter(String name, char val); ! public void setBoolean(String name, boolean val); ! public void setByte(String name, byte val); ! public void setShort(String name, short val); ! public void setInteger(String name, int val); ! public void setLong(String name, long val); ! public void setFloat(String name, float val); ! public void setDouble(String name, double val); ! public void setBinary(String name, byte[] val); ! public void setSerializable(String name, Serializable val); ! public void setLocale(String name, Locale locale); ! public void setBigDecimal(String name, BigDecimal number); ! public void setDate(String name, Date date); ! public void setTime(String name, Date date); ! public void setTimestamp(String name, Date date); ! public void setCalendar(String name, Calendar calendar); ! public void setCalendarDate(String name, Calendar calendar); /** --- 185,231 ---- * @param bean any JavaBean or POJO */ ! public Query setProperties(Object bean) throws HibernateException; ! public Query setString(int position, String val); ! public Query setCharacter(int position, char val); ! public Query setBoolean(int position, boolean val); ! public Query setByte(int position, byte val); ! public Query setShort(int position, short val); ! public Query setInteger(int position, int val); ! public Query setLong(int position, long val); ! public Query setFloat(int position, float val); ! public Query setDouble(int position, double val); ! public Query setBinary(int position, byte[] val); ! public Query setSerializable(int position, Serializable val); ! public Query setLocale(int position, Locale locale); ! public Query setBigDecimal(int position, BigDecimal number); ! public Query setDate(int position, Date date); ! public Query setTime(int position, Date date); ! public Query setTimestamp(int position, Date date); ! public Query setCalendar(int position, Calendar calendar); ! public Query setCalendarDate(int position, Calendar calendar); ! public Query setString(String name, String val); ! public Query setCharacter(String name, char val); ! public Query setBoolean(String name, boolean val); ! public Query setByte(String name, byte val); ! public Query setShort(String name, short val); ! public Query setInteger(String name, int val); ! public Query setLong(String name, long val); ! public Query setFloat(String name, float val); ! public Query setDouble(String name, double val); ! public Query setBinary(String name, byte[] val); ! public Query setSerializable(String name, Serializable val); ! public Query setLocale(String name, Locale locale); ! public Query setBigDecimal(String name, BigDecimal number); ! public Query setDate(String name, Date date); ! public Query setTime(String name, Date date); ! public Query setTimestamp(String name, Date date); ! public Query setCalendar(String name, Calendar calendar); ! public Query setCalendarDate(String name, Calendar calendar); /** *************** *** 235,239 **** * @param val a non-null instance of a persistent class */ ! public void setEntity(int position, Object val); // use setParameter for null values /** * Bind an instance of a persistent enumeration class to a JDBC-style query parameter. --- 235,239 ---- * @param val a non-null instance of a persistent class */ ! public Query setEntity(int position, Object val); // use setParameter for null values /** * Bind an instance of a persistent enumeration class to a JDBC-style query parameter. *************** *** 242,246 **** * @param val a non-null instance of a persistent enumeration */ ! public void setEnum(int position, Object val) throws MappingException; // use setParameter for null values /** --- 242,246 ---- * @param val a non-null instance of a persistent enumeration */ ! public Query setEnum(int position, Object val) throws MappingException; // use setParameter for null values /** *************** *** 249,253 **** * @param val a non-null instance of a persistent class */ ! public void setEntity(String name, Object val); // use setParameter for null values /** * Bind an instance of a mapped persistent enumeration class to a named query parameter. --- 249,253 ---- * @param val a non-null instance of a persistent class */ ! public Query setEntity(String name, Object val); // use setParameter for null values /** * Bind an instance of a mapped persistent enumeration class to a named query parameter. *************** *** 255,259 **** * @param val a non-null instance of a persistent enumeration */ ! public void setEnum(String name, Object val) throws MappingException; // use setParameter for null values } --- 255,259 ---- * @param val a non-null instance of a persistent enumeration */ ! public Query setEnum(String name, Object val) throws MappingException; // use setParameter for null values } Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Session.java 24 Feb 2003 11:53:45 -0000 1.7 --- Session.java 4 Mar 2003 10:53:46 -0000 1.8 *************** *** 8,11 **** --- 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 *************** *** 277,280 **** --- 278,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. |