You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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); /** |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/expression In directory sc8-pr-cvs1:/tmp/cvs-serv15856/sf/hibernate/expression Added Files: AndExpression.java EqExpression.java Expression.java GeExpression.java GtExpression.java LeExpression.java LikeExpression.java LogicalExpression.java LtExpression.java NotExpression.java OrExpression.java SQLExpression.java SimpleExpression.java Log Message: added new criteria + expression API (experimental) --- NEW FILE: AndExpression.java --- package net.sf.hibernate.expression; /** * */ public class AndExpression extends LogicalExpression { String getOp() { return "and"; } AndExpression(Expression lhs, Expression rhs) { super(lhs, rhs); } } --- NEW FILE: EqExpression.java --- //$Id: EqExpression.java,v 1.1 2003/03/08 06:31:22 oneovthafew Exp $ package net.sf.hibernate.expression; /** * */ public class EqExpression extends SimpleExpression { EqExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return "="; } } --- NEW FILE: Expression.java --- //$Id: Expression.java,v 1.1 2003/03/08 06:31:22 oneovthafew Exp $ package net.sf.hibernate.expression; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.persister.Queryable; import net.sf.hibernate.type.Type; /** * An object-oriented representation of expressions that may be used as constraints * in a <tt>Criteria</tt>. The <tt>expression</tt> package may be used by applications * as a framework for building new kinds of <tt>Expression</tt>. However, it is * intended that most applications will simply use the built-in expression types via * the static accessors on this class. * * @see net.sf.hibernate.Criteria */ public abstract class Expression { private static final Object[] NO_OBJECTS = new Object[0]; private static final Type[] NO_TYPES = new Type[0]; /** * Apply an "equal" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression eq(String propertyName, Object value) { return new EqExpression(propertyName, value); } /** * Apply a "like" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression like(String propertyName, Object value) { return new LikeExpression(propertyName, value); } /** * Apply a "greater than" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression gt(String propertyName, Object value) { return new GtExpression(propertyName, value); } /** * Apply a "less than" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression lt(String propertyName, Object value) { return new LtExpression(propertyName, value); } /** * Apply a "less than or equal" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression le(String propertyName, Object value) { return new LeExpression(propertyName, value); } /** * Apply a "greater than or equal" constraint to the named property * @param propertyName * @param value * @return Expression */ public static Expression ge(String propertyName, Object value) { return new GtExpression(propertyName, value); } /** * Return the conjuction of two expressions * * @param lhs * @param rhs * @return Expression */ public static Expression and(Expression lhs, Expression rhs) { return new AndExpression(lhs, rhs); } /** * Return the disjuction of two expressions * * @param lhs * @param rhs * @return Expression */ public static Expression or(Expression lhs, Expression rhs) { return new OrExpression(lhs, rhs); } /** * Return the negation of an expression * * @param expression * @return Expression */ public static Expression not(Expression expression) { return new NotExpression(expression); } /** * Apply a constraint expressed in SQL, with the given JDBC * parameters * * @param sql * @param values * @param types * @return Expression */ public static Expression sql(String sql, Object[] values, Type[] types) { return new SQLExpression(sql, values, types); } /** * Apply a constraint expressed in SQL, with the given JDBC * parameter * * @param sql * @param value * @param type * @return Expression */ public static Expression sql(String sql, Object value, Type type) { return new SQLExpression(sql, new Object[] { value }, new Type[] { type } ); } /** * Apply a constraint expressed in SQL * * @param sql * @return Expression */ public static Expression sql(String sql) { return new SQLExpression(sql, NO_OBJECTS, NO_TYPES); } /** * Render and SQL fragment * * @param sessionFactory * @param persistentClass * @param alias * @return String * @throws HibernateException */ public abstract String toSqlString(SessionFactoryImplementor sessionFactory, Class persistentClass, String alias) throws HibernateException; /** * Return typed values for all parameters in the rendered SQL fragment * * @param sessionFactory * @param persistentClass * @return TypedValue[] * @throws HibernateException */ public abstract TypedValue[] getTypedValues(SessionFactoryImplementor sessionFactory, Class persistentClass) throws HibernateException; /** * For cosmetic purposes only! * * @see java.lang.Object#toString() */ public abstract String toString(); protected String[] getColumns(SessionFactoryImplementor sessionFactory, Class persistentClass, String property, String alias) throws HibernateException { return ( (Queryable) sessionFactory.getPersister(persistentClass) ).toColumns(alias, property); } protected TypedValue getTypedValue(SessionFactoryImplementor sessionFactory, Class persistentClass, String propertyName, Object value) throws HibernateException { return new TypedValue( ( (Queryable) sessionFactory.getPersister(persistentClass) ).getPropertyType(propertyName), value ); } } --- NEW FILE: GeExpression.java --- package net.sf.hibernate.expression; /** * */ public class GeExpression extends SimpleExpression { GeExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return ">="; } } --- NEW FILE: GtExpression.java --- package net.sf.hibernate.expression; /** * */ public class GtExpression extends SimpleExpression { GtExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return ">"; } } --- NEW FILE: LeExpression.java --- package net.sf.hibernate.expression; /** * */ public class LeExpression extends SimpleExpression { LeExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return "<="; } } --- NEW FILE: LikeExpression.java --- package net.sf.hibernate.expression; /** * */ public class LikeExpression extends SimpleExpression { LikeExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return " like "; } } --- NEW FILE: LogicalExpression.java --- package net.sf.hibernate.expression; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.TypedValue; /** * */ public abstract class LogicalExpression extends Expression { protected Expression lhs; protected Expression rhs; LogicalExpression(Expression lhs, Expression rhs) { this.lhs = lhs; this.rhs = rhs; } /** * @see net.sf.hibernate.expression.Expression#getTypedValues(net.sf.hibernate.engine.SessionFactoryImplementor, java.lang.Class) */ public TypedValue[] getTypedValues( SessionFactoryImplementor sessionFactory, Class persistentClass) throws HibernateException { TypedValue[] lhstv = lhs.getTypedValues(sessionFactory, persistentClass); TypedValue[] rhstv = rhs.getTypedValues(sessionFactory, persistentClass); TypedValue[] result = new TypedValue[ lhstv.length + rhstv.length ]; System.arraycopy(lhstv, 0, result, 0, lhstv.length); System.arraycopy(rhstv, 0, result, lhstv.length, rhstv.length); return result; } public String toSqlString( SessionFactoryImplementor sessionFactory, Class persistentClass, String alias) throws HibernateException { return '(' + lhs.toSqlString(sessionFactory, persistentClass, alias) + ' ' + getOp() + ' ' + rhs.toSqlString(sessionFactory, persistentClass, alias) + ')'; } abstract String getOp(); public String toString() { return lhs.toString() + ' ' + getOp() + ' ' + rhs.toString(); } } --- NEW FILE: LtExpression.java --- package net.sf.hibernate.expression; /** * */ public class LtExpression extends SimpleExpression { LtExpression(String propertyName, Object value) { super(propertyName, value); } /** * @see net.sf.hibernate.expression.SimpleExpression#getOp() */ String getOp() { return "<"; } } --- NEW FILE: NotExpression.java --- //$Id: NotExpression.java,v 1.1 2003/03/08 06:31:22 oneovthafew Exp $ package net.sf.hibernate.expression; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.TypedValue; /** */ public class NotExpression extends Expression { private Expression expression; NotExpression(Expression expression) { this.expression = expression; } /** * @see net.sf.hibernate.expression.Expression#toSqlString(net.sf.hibernate.engine.SessionFactoryImplementor, java.lang.Class, java.lang.String) */ public String toSqlString( SessionFactoryImplementor sessionFactory, Class persistentClass, String alias) throws HibernateException { return "not " + expression.toSqlString(sessionFactory, persistentClass, alias); } /** * @see net.sf.hibernate.expression.Expression#getTypedValues(net.sf.hibernate.engine.SessionFactoryImplementor, java.lang.Class) */ public TypedValue[] getTypedValues( SessionFactoryImplementor sessionFactory, Class persistentClass) throws HibernateException { return expression.getTypedValues(sessionFactory, persistentClass); } /** * @see java.lang.Object#toString() */ public String toString() { return "not " + expression.toString(); } } --- NEW FILE: OrExpression.java --- package net.sf.hibernate.expression; /** * */ public class OrExpression extends LogicalExpression { String getOp() { return "or"; } OrExpression(Expression lhs, Expression rhs) { super(lhs, rhs); } } --- NEW FILE: SQLExpression.java --- //$Id: SQLExpression.java,v 1.1 2003/03/08 06:31:22 oneovthafew Exp $ package net.sf.hibernate.expression; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.type.Type; /** * */ public class SQLExpression extends Expression { private String sql; private TypedValue[] typedValues; /** * @see net.sf.hibernate.expression.Expression#toSqlString(net.sf.hibernate.engine.SessionFactoryImplementor, java.lang.Class, java.lang.String) */ public String toSqlString( SessionFactoryImplementor sessionFactory, Class persistentClass, String alias) throws HibernateException { return sql; } /** * @see net.sf.hibernate.expression.Expression#getTypedValues(net.sf.hibernate.engine.SessionFactoryImplementor, java.lang.Class) */ public TypedValue[] getTypedValues( SessionFactoryImplementor sessionFactory, Class persistentClass) throws HibernateException { return typedValues; } /** * @see java.lang.Object#toString() */ public String toString() { return sql; } SQLExpression(String sql, Object[] values, Type[] types) { typedValues = new TypedValue[values.length]; for ( int i=0; i<typedValues.length; i++ ) { typedValues[i] = new TypedValue( types[i], values[i] ); } } } --- NEW FILE: SimpleExpression.java --- package net.sf.hibernate.expression; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.util.StringHelper; /** * */ public abstract class SimpleExpression extends Expression { private final String propertyName; private final Object value; SimpleExpression(String propertyName, Object value) { this.propertyName = propertyName; this.value = value; } /** * @see net.sf.hibernate.expression.Expression#toSqlString(net.sf.hibernate.SessionFactory) */ public String toSqlString(SessionFactoryImplementor sessionFactory, Class persistentClass, String alias) throws HibernateException { return StringHelper.join( " and ", StringHelper.suffix( getColumns(sessionFactory, persistentClass, propertyName, alias), getOp() + "?" ) ); //TODO: get SQL rendering out of this package! } public TypedValue[] getTypedValues(SessionFactoryImplementor sessionFactory, Class persistentClass) throws HibernateException { return new TypedValue[] { getTypedValue(sessionFactory, persistentClass, propertyName, value) }; } public String toString() { return propertyName + getOp() + value; } abstract String getOp(); } |
From: <one...@us...> - 2003-03-08 06:39:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jca In directory sc8-pr-cvs1:/tmp/cvs-serv15856/sf/hibernate/jca Modified Files: JCASessionImpl.java LocalTransactionImpl.java MetaDataImpl.java Log Message: added new criteria + expression API (experimental) Index: JCASessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jca/JCASessionImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JCASessionImpl.java 2 Mar 2003 15:28:13 -0000 1.1 --- JCASessionImpl.java 8 Mar 2003 06:31:23 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- import java.util.List; + import net.sf.hibernate.Criteria; import net.sf.hibernate.FlushMode; import net.sf.hibernate.HibernateException; *************** *** 242,245 **** --- 243,250 ---- void setManagedConnection(ManagedConnectionImpl mc){ this.mc = mc; + } + + public Criteria createCriteria(Class persistentClass) { + return session.createCriteria(persistentClass); } Index: LocalTransactionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jca/LocalTransactionImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LocalTransactionImpl.java 2 Mar 2003 15:28:13 -0000 1.1 --- LocalTransactionImpl.java 8 Mar 2003 06:31:23 -0000 1.2 *************** *** 4,10 **** import java.sql.SQLException; - import javax.jms.JMSException; import javax.resource.ResourceException; - import javax.resource.spi.ConnectionEvent; import javax.resource.spi.EISSystemException; import javax.resource.spi.LocalTransaction; --- 4,8 ---- Index: MetaDataImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jca/MetaDataImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MetaDataImpl.java 2 Mar 2003 15:28:13 -0000 1.1 --- MetaDataImpl.java 8 Mar 2003 06:31:23 -0000 1.2 *************** *** 5,9 **** import javax.resource.ResourceException; import javax.resource.spi.EISSystemException; - import javax.resource.spi.IllegalStateException; import javax.resource.spi.ManagedConnectionMetaData; --- 5,8 ---- |
From: <one...@us...> - 2003-03-08 06:39:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv15856/sf/hibernate/loader Modified Files: AbstractEntityLoader.java EntityLoader.java Log Message: added new criteria + expression API (experimental) Index: AbstractEntityLoader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/AbstractEntityLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractEntityLoader.java 4 Mar 2003 10:53:47 -0000 1.1 --- AbstractEntityLoader.java 8 Mar 2003 06:31:23 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + //$Id$ package net.sf.hibernate.loader; Index: EntityLoader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/EntityLoader.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EntityLoader.java 4 Mar 2003 10:53:47 -0000 1.12 --- EntityLoader.java 8 Mar 2003 06:31:23 -0000 1.13 *************** *** 26,30 **** idType = new Type[] { persister.getIdentifierType() }; ! String condition = new ConditionFragment().setTableAlias(alias) .setCondition( persister.getIdentifierColumnNames(), "?" ) .toFragmentString(); --- 26,31 ---- idType = new Type[] { persister.getIdentifierType() }; ! String condition = new ConditionFragment() ! .setTableAlias(alias) .setCondition( persister.getIdentifierColumnNames(), "?" ) .toFragmentString(); |
From: <one...@us...> - 2003-03-08 06:39:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv15856/sf/hibernate/test Modified Files: FooBarTest.java MasterDetailTest.java Log Message: added new criteria + expression API (experimental) Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** FooBarTest.java 6 Mar 2003 11:11:45 -0000 1.38 --- FooBarTest.java 8 Mar 2003 06:31:23 -0000 1.39 *************** *** 12,16 **** import java.util.List; import java.util.Locale; - import java.util.Map; import java.util.Set; import java.util.TimeZone; --- 12,15 ---- *************** *** 20,23 **** --- 19,23 ---- import junit.framework.Test; import junit.framework.TestSuite; + import net.sf.hibernate.expression.Expression; import net.sf.hibernate.Databinder; import net.sf.hibernate.FlushMode; *************** *** 136,154 **** } ! /*public void testFindLike() throws Exception { Session s = sessions.openSession(); Foo f = new Foo(); s.save(f); s.flush(); ! Map map = new HashMap(); ! map.put( "integer", f.getInteger() ); ! map.put( "string", f.getString() ); ! map.put( "boolean", f.getBoolean() ); ! List list = s.find(Foo.class, map); assertTrue( list.size()==1 && list.get(0)==f ); s.delete(f); s.flush(); s.close(); ! }*/ public void testAfterDelete() throws Exception { --- 136,170 ---- } ! public void testFindByCriteria() throws Exception { Session s = sessions.openSession(); Foo f = new Foo(); s.save(f); s.flush(); ! List list = s.createCriteria(Foo.class) ! .add( Expression.eq( "integer", f.getInteger() ) ) ! .add( Expression.like( "string", f.getString() ) ) ! .add( Expression.eq( "boolean", f.getBoolean() ) ) ! .list(); ! assertTrue( list.size()==1 && list.get(0)==f ); ! list = s.createCriteria(Foo.class) ! .add( Expression.or( ! Expression.and( ! Expression.eq( "integer", f.getInteger() ), ! Expression.like( "string", f.getString() ) ! ), ! Expression.eq( "boolean", f.getBoolean() ) ! ) ) ! .list(); assertTrue( list.size()==1 && list.get(0)==f ); + list = s.createCriteria(Foo.class).setMaxResults(5).list(); + assertTrue( list.size()==1 && list.get(0)==f ); + list = s.createCriteria(Foo.class).setMaxResults(0).list(); + assertTrue( list.size()==0 ); + list = s.createCriteria(Foo.class).setFirstResult(1).list(); + assertTrue( list.size()==0 ); s.delete(f); s.flush(); s.close(); ! } public void testAfterDelete() throws Exception { Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetailTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MasterDetailTest.java 23 Feb 2003 01:32:21 -0000 1.4 --- MasterDetailTest.java 8 Mar 2003 06:31:23 -0000 1.5 *************** *** 78,82 **** } - public void testMasterDetail() throws Exception { Session s = sessions.openSession(); --- 78,81 ---- |
From: <one...@us...> - 2003-03-08 06:39:24
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv18274/sf/hibernate/loader Added Files: CriteriaLoader.java Removed Files: SearchLoader.java Log Message: added new criteria + expression API (experimental) --- NEW FILE: CriteriaLoader.java --- //$Id: CriteriaLoader.java,v 1.1 2003/03/08 06:39:21 oneovthafew Exp $ package net.sf.hibernate.loader; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.RowSelection; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.expression.Expression; import net.sf.hibernate.impl.CriteriaImpl; import net.sf.hibernate.persister.Loadable; import net.sf.hibernate.type.Type; //TODO: this class depends directly upon CriteriaImpl, in the impl package ... add a CriteriaImplementor interface public class CriteriaLoader extends AbstractEntityLoader { private CriteriaImpl criteria; private static final Type[] NO_TYPES = new Type[0]; public CriteriaLoader(Loadable persister, SessionFactoryImplementor factory, CriteriaImpl criteria) throws HibernateException { super(persister, factory); this.criteria = criteria; StringBuffer condition = new StringBuffer(30); Iterator iter = criteria.iterateExpressions(); if ( !iter.hasNext() ) condition.append(" 1=1"); //TODO: fix this ugliness while ( iter.hasNext() ) { Expression expr = (Expression) iter.next(); condition.append( expr.toSqlString(factory, criteria.getPersistentClass(), alias) ); if ( iter.hasNext() ) condition.append(" and "); } renderStatement( condition.toString(), factory ); } public List list(SessionImplementor session) throws HibernateException, SQLException { List values = new ArrayList(); List types = new ArrayList(); Iterator iter = criteria.iterateExpressions(); while ( iter.hasNext() ) { Expression expr = (Expression) iter.next(); TypedValue[] tv = expr.getTypedValues( session.getFactory(), criteria.getPersistentClass() ); for ( int i=0; i<tv.length; i++ ) { values.add( tv[i].getValue() ); types.add( tv[i].getType() ); } } Object[] valueArray = values.toArray(); Type[] typeArray = (Type[]) types.toArray(NO_TYPES); RowSelection selection = new RowSelection(); selection.setFirstRow( criteria.getFirstResult() ); selection.setMaxRows( criteria.getMaxResults() ); selection.setTimeout( criteria.getTimeout() ); return find(session, valueArray, typeArray, true, selection, null); } protected Object getResultColumnOrRow(Object[] row, ResultSet rs, SessionImplementor session) throws SQLException, HibernateException { return row[ row.length-1 ]; }; } --- SearchLoader.java DELETED --- |
From: <one...@us...> - 2003-03-08 06:39:24
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv18274/sf/hibernate/impl Added Files: CriteriaImpl.java Log Message: added new criteria + expression API (experimental) --- NEW FILE: CriteriaImpl.java --- //$Id: CriteriaImpl.java,v 1.1 2003/03/08 06:39:21 oneovthafew Exp $ package net.sf.hibernate.impl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import net.sf.hibernate.Criteria; import net.sf.hibernate.HibernateException; import net.sf.hibernate.expression.Expression; public class CriteriaImpl implements Criteria { private List expressions = new ArrayList(); private Integer maxResults; private Integer firstResult; private Integer timeout; private Class persistentClass; private SessionImpl session; public Criteria setMaxResults(int maxResults) { this.maxResults = new Integer(maxResults); return this; } public Criteria setFirstResult(int firstResult) { this.firstResult = new Integer(firstResult); return this; } public Criteria setTimeout(int timeout) { this.timeout = new Integer(timeout); return this; } public Criteria add(Expression expression) { expressions.add(expression); return this; } public Integer getMaxResults() { return maxResults; } public Integer getFirstResult() { return firstResult; } public Integer getTimeout() { return timeout; } public CriteriaImpl(Class persistentClass, SessionImpl session) { this.persistentClass = persistentClass; this.session = session; } public List list() throws HibernateException { return session.find(this); } public Iterator iterateExpressions() { return expressions.iterator(); } public Class getPersistentClass() { return persistentClass; } public String toString() { return expressions.toString(); } } |
From: <one...@us...> - 2003-03-08 06:27:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/expression In directory sc8-pr-cvs1:/tmp/cvs-serv15221/sf/hibernate/expression Log Message: Directory /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/expression added to the repository |
From: <one...@us...> - 2003-03-06 11:21:44
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv14212/hibernate/test Modified Files: MultiTableTest.java Log Message: detect collection modifications not made via wrapper Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/MultiTableTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** MultiTableTest.java 30 Dec 2002 13:11:42 -0000 1.22 --- MultiTableTest.java 6 Mar 2003 10:55:09 -0000 1.23 *************** *** 7,10 **** --- 7,11 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 258,262 **** } ! public static Test suite() throws Exception { try { --- 259,283 ---- } ! public void testCollectionPointer() throws Exception { ! Session sess = sessions.openSession(); ! LessSimple ls = new LessSimple(); ! List list = new ArrayList(); ! ls.setBag(list); ! Simple s = new Simple(); ! Serializable id = sess.save(ls); ! sess.save(s); ! sess.flush(); ! list.add(s); ! sess.flush(); ! sess.connection().commit(); ! ! sess = sessions.openSession(); ! ls = (LessSimple) sess.load(LessSimple.class, id); ! assertTrue( ls.getBag().size()==1 ); ! sess.delete("from o in class java.lang.Object"); ! sess.flush(); ! sess.connection().commit(); ! } ! public static Test suite() throws Exception { try { |
From: <one...@us...> - 2003-03-06 11:21:43
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv14212/hibernate/impl Modified Files: SessionImpl.java Log Message: detect collection modifications not made via wrapper Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionImpl.java,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** SessionImpl.java 15 Feb 2003 01:14:37 -0000 1.163 --- SessionImpl.java 6 Mar 2003 10:55:09 -0000 1.164 *************** *** 228,232 **** boolean isDirty(PersistentCollection coll) throws HibernateException { if ( dirty || ( ! !coll.isArrayHolder() && !loadedPersister.getElementType().isMutable() ) ) { return dirty; --- 228,232 ---- boolean isDirty(PersistentCollection coll) throws HibernateException { if ( dirty || ( ! !coll.isDirectlyAccessible() && !loadedPersister.getElementType().isMutable() ) ) { return dirty; |
From: <one...@us...> - 2003-03-06 11:12:43
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv21330/sf/hibernate Modified Files: Session.java Log Message: detect collection modifications not made via wrapper Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Session.java 4 Mar 2003 10:53:46 -0000 1.8 --- Session.java 6 Mar 2003 11:12:06 -0000 1.9 *************** *** 286,290 **** * @throws HibernateException */ ! public List find(Class persistentClass, Map propertyNameValues) throws HibernateException; /** --- 286,290 ---- * @throws HibernateException */ ! //public List find(Class persistentClass, Map propertyNameValues) throws HibernateException; /** |
From: <one...@us...> - 2003-03-06 11:12:38
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv21330/sf/hibernate/impl Modified Files: SessionImpl.java Log Message: detect collection modifications not made via wrapper Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** SessionImpl.java 4 Mar 2003 10:53:46 -0000 1.23 --- SessionImpl.java 6 Mar 2003 11:11:53 -0000 1.24 *************** *** 245,249 **** boolean isDirty(PersistentCollection coll) throws HibernateException { if ( dirty || ( ! !coll.isArrayHolder() && !loadedPersister.getElementType().isMutable() ) ) { return dirty; --- 245,249 ---- boolean isDirty(PersistentCollection coll) throws HibernateException { if ( dirty || ( ! !coll.isDirectlyAccessible() && !loadedPersister.getElementType().isMutable() ) ) { return dirty; |
From: <one...@us...> - 2003-03-06 11:12:33
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv21330/sf/hibernate/test Modified Files: MultiTableTest.java FooBarTest.java Log Message: detect collection modifications not made via wrapper Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MultiTableTest.java 3 Mar 2003 09:31:13 -0000 1.8 --- MultiTableTest.java 6 Mar 2003 11:11:39 -0000 1.9 *************** *** 7,10 **** --- 7,11 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 36,45 **** Session s = sessions.openSession(); ! if (dialect instanceof SybaseDialect) { ! s.save( new TrivialClass() ); } else{ ! s.save( new TrivialClass(), new Long(1) ); } --- 37,46 ---- Session s = sessions.openSession(); ! Long id = new Long(1); if (dialect instanceof SybaseDialect) { ! id = (Long) s.save( new TrivialClass() ); } else{ ! s.save( new TrivialClass(), id ); } *************** *** 48,52 **** s.close(); s = sessions.openSession(); ! TrivialClass tc = (TrivialClass) s.load( TrivialClass.class, new Long(1) ); s.find("from s in class TrivialClass where s.id = 2"); s.find("select s.count from s in class Simple"); --- 49,53 ---- s.close(); s = sessions.openSession(); ! TrivialClass tc = (TrivialClass) s.load(TrivialClass.class, id); s.find("from s in class TrivialClass where s.id = 2"); s.find("select s.count from s in class Simple"); *************** *** 434,437 **** --- 435,458 ---- } + public void testCollectionPointer() throws Exception { + Session sess = sessions.openSession(); + LessSimple ls = new LessSimple(); + List list = new ArrayList(); + ls.setBag(list); + Simple s = new Simple(); + Serializable id = sess.save(ls); + sess.save(s); + sess.flush(); + list.add(s); + sess.flush(); + sess.connection().commit(); + + sess = sessions.openSession(); + ls = (LessSimple) sess.load(LessSimple.class, id); + assertTrue( ls.getBag().size()==1 ); + sess.delete("from o in class java.lang.Object"); + sess.flush(); + sess.connection().commit(); + } public static Test suite() throws Exception { Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** FooBarTest.java 4 Mar 2003 10:53:47 -0000 1.37 --- FooBarTest.java 6 Mar 2003 11:11:45 -0000 1.38 *************** *** 136,140 **** } ! public void testFindLike() throws Exception { Session s = sessions.openSession(); Foo f = new Foo(); --- 136,140 ---- } ! /*public void testFindLike() throws Exception { Session s = sessions.openSession(); Foo f = new Foo(); *************** *** 150,154 **** s.flush(); s.close(); ! } public void testAfterDelete() throws Exception { --- 150,154 ---- s.flush(); s.close(); ! }*/ public void testAfterDelete() throws Exception { |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv21330/sf/hibernate/collection Modified Files: ArrayHolder.java Bag.java List.java Map.java PersistentCollection.java Set.java Log Message: detect collection modifications not made via wrapper Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ArrayHolder.java 19 Feb 2003 01:51:30 -0000 1.9 --- ArrayHolder.java 6 Mar 2003 11:12:08 -0000 1.10 *************** *** 166,170 **** } ! public boolean isArrayHolder() { return true; } --- 166,170 ---- } ! public boolean isDirectlyAccessible() { return true; } Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Bag.java 19 Feb 2003 01:51:30 -0000 1.8 --- Bag.java 6 Mar 2003 11:12:09 -0000 1.9 *************** *** 42,45 **** --- 42,46 ---- } initialized = true; + directlyAccessible = true; } Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** List.java 19 Feb 2003 01:51:30 -0000 1.9 --- List.java 6 Mar 2003 11:12:10 -0000 1.10 *************** *** 54,57 **** --- 54,58 ---- this.list = list; initialized = true; + directlyAccessible = true; } public void beforeInitialize(CollectionPersister persister) { Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Map.java 19 Feb 2003 01:51:30 -0000 1.9 --- Map.java 6 Mar 2003 11:12:11 -0000 1.10 *************** *** 59,62 **** --- 59,63 ---- this.map = map; initialized = true; + directlyAccessible = true; } Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/PersistentCollection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PersistentCollection.java 19 Feb 2003 01:51:30 -0000 1.8 --- PersistentCollection.java 6 Mar 2003 11:12:11 -0000 1.9 *************** *** 49,52 **** --- 49,53 ---- private transient List additions; private CollectionSnapshot collectionSnapshot; + protected transient boolean directlyAccessible; //Careful: these methods do not initialize the collection. *************** *** 158,163 **** } ! public boolean isArrayHolder() { ! return false; } --- 159,164 ---- } ! public boolean isDirectlyAccessible() { ! return directlyAccessible; } Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Set.java 19 Feb 2003 01:51:30 -0000 1.8 --- Set.java 6 Mar 2003 11:12:12 -0000 1.9 *************** *** 69,72 **** --- 69,73 ---- this.set = set; initialized = true; + directlyAccessible = true; } public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { |
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections In directory sc8-pr-cvs1:/tmp/cvs-serv14212/hibernate/collections Modified Files: ArrayHolder.java Bag.java List.java Map.java PersistentCollection.java Set.java Log Message: detect collection modifications not made via wrapper Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/ArrayHolder.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ArrayHolder.java 26 Nov 2002 03:35:41 -0000 1.50 --- ArrayHolder.java 6 Mar 2003 10:55:08 -0000 1.51 *************** *** 168,172 **** } ! public boolean isArrayHolder() { return true; } --- 168,172 ---- } ! public boolean isDirectlyAccessible() { return true; } Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/Bag.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Bag.java 17 Dec 2002 09:43:18 -0000 1.18 --- Bag.java 6 Mar 2003 10:55:09 -0000 1.19 *************** *** 43,46 **** --- 43,47 ---- } initialized = true; + directlyAccessible = true; } Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/List.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** List.java 17 Dec 2002 09:43:18 -0000 1.46 --- List.java 6 Mar 2003 10:55:09 -0000 1.47 *************** *** 56,59 **** --- 56,60 ---- this.list = list; initialized = true; + directlyAccessible = true; } public void beforeInitialize(CollectionPersister persister) { Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/Map.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Map.java 19 Dec 2002 11:29:03 -0000 1.47 --- Map.java 6 Mar 2003 10:55:09 -0000 1.48 *************** *** 59,62 **** --- 59,63 ---- this.map = map; initialized = true; + directlyAccessible = true; } Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/PersistentCollection.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** PersistentCollection.java 24 Dec 2002 13:45:37 -0000 1.79 --- PersistentCollection.java 6 Mar 2003 10:55:09 -0000 1.80 *************** *** 2,8 **** package cirrus.hibernate.collections; ! import cirrus.hibernate.type.Type; ! import cirrus.hibernate.impl.CollectionPersister; ! import java.util.ArrayList; import java.util.Collection; --- 2,9 ---- package cirrus.hibernate.collections; ! import java.io.Serializable; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; *************** *** 11,21 **** import java.util.ListIterator; - import cirrus.hibernate.*; - import java.sql.*; - import java.io.*; - import org.apache.commons.logging.LogFactory; import cirrus.hibernate.engine.SessionImplementor; /** --- 12,23 ---- import java.util.ListIterator; import org.apache.commons.logging.LogFactory; + import cirrus.hibernate.AssertionFailure; + import cirrus.hibernate.HibernateException; + import cirrus.hibernate.LazyInitializationException; import cirrus.hibernate.engine.SessionImplementor; + import cirrus.hibernate.impl.CollectionPersister; + import cirrus.hibernate.type.Type; /** *************** *** 44,47 **** --- 46,50 ---- protected transient SessionImplementor session; protected boolean initialized; + protected boolean directlyAccessible; private transient List additions; *************** *** 149,154 **** } ! public boolean isArrayHolder() { ! return false; } --- 152,157 ---- } ! public boolean isDirectlyAccessible() { ! return directlyAccessible; } Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/Set.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Set.java 26 Nov 2002 03:35:41 -0000 1.50 --- Set.java 6 Mar 2003 10:55:09 -0000 1.51 *************** *** 78,81 **** --- 78,82 ---- this.set = set; initialized = true; + directlyAccessible = true; } |
From: <one...@us...> - 2003-03-05 10:03:38
|
Update of /cvsroot/hibernate/Hibernate/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12236 Added Files: ant.jar optional.jar Log Message: added Ant --- NEW FILE: ant.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: optional.jar --- (This appears to be a binary file; contents omitted.) |
From: <one...@us...> - 2003-03-05 09:50:11
|
Update of /cvsroot/hibernate/Hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv9628 Modified Files: changelog.txt Log Message: recent changes Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate/changelog.txt,v retrieving revision 1.297 retrieving revision 1.298 diff -C2 -d -r1.297 -r1.298 *** changelog.txt 19 Feb 2003 12:38:54 -0000 1.297 --- changelog.txt 5 Mar 2003 09:50:04 -0000 1.298 *************** *** 7,10 **** --- 7,12 ---- * fixed an exception that occurs with <key-many-to-one> association to a class with a composite id (Stefano Travelli) * fixed a bug in Hibernate PreparedStatement cache where maxRows and FetchSize were not cleared before re-caching + * support [] quoted identifiers + * added Ant Tasks for SchemaExport and SchemaUpdater (Cameron Braid) Changes in version 1.2.3 (28.1.2003) |
From: <one...@us...> - 2003-03-05 09:48:57
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv9044 Modified Files: changelog.txt Log Message: recent changes Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/changelog.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** changelog.txt 1 Mar 2003 20:15:30 -0000 1.9 --- changelog.txt 5 Mar 2003 09:48:53 -0000 1.10 *************** *** 2,11 **** =================== ! Changes in version 2.x beta x (x.x.2003) ---------------------------------------- * hbm2java now can generate Beans style property events (Klaus Zimmermann) ! Changes in version 2.0 beta 3 (2.2.2003) ---------------------------------------- * collections now deserialize correctly (fix for bug in beta 2) * standardised on dom4j for XML parsing --- 2,26 ---- =================== ! Changes in version 2.0 beta 4 (x.x.2003) ---------------------------------------- + * Major HQL improvements + - from "Foo as foo join foo.bars as bar" instead of "from foo in class Foo, bar in elements(foo.bars)" + - "select new Foo(bar.name, bar.amount) from ...." + - outer and full join support + * Query methods now return this, to allow chaining + * FrontBase support (Run Lussier) + * experimental JCA support (Daniel Bradby) * hbm2java now can generate Beans style property events (Klaus Zimmermann) + * support SQL identifiers quoted with [] + * fixed bug with PostgreSQL + * name attribute now optional in .cfg.xml + * support for postgres ilike operator (M Lang) + * squash warnings with GNU JAXP (Chris Nockleberg) + * fixed a bug in Query.setParameterList() + * Ingres support (Ian Booth) ! Changes in version 2.0 beta 3 (24.2.2003) ---------------------------------------- + * collections now represent null elements as a missing row * collections now deserialize correctly (fix for bug in beta 2) * standardised on dom4j for XML parsing *************** *** 15,19 **** * fixed a stack overflow that could occur in toString() of classes created with hbm2java (Max Andersen) * fixed a bug where composite-element <parent> property was not being set after retrieval from cache ! * added where attribute to collection mappings * fixed a exception that occurred when wrapping collections with sort="MyComparator" (Jason Horne) * objects with mutable="false" are now never updated --- 30,34 ---- * fixed a stack overflow that could occur in toString() of classes created with hbm2java (Max Andersen) * fixed a bug where composite-element <parent> property was not being set after retrieval from cache ! * added where attribute to collection mappings to allow filtering * fixed a exception that occurred when wrapping collections with sort="MyComparator" (Jason Horne) * objects with mutable="false" are now never updated *************** *** 26,29 **** --- 41,47 ---- * Lists and arrays now represent null elements as a missing row * fixed a bug in Hibernate PreparedStatement cache where maxRows and fetchSize were not cleared before re-caching + * fixed a bug in HibernateService that caused a restart to fail + * added SybaseAnywhereDialect () + * added SessionFactory.close() Changes in version 2.0 beta 2 (2.2.2003) |
From: <one...@us...> - 2003-03-04 14:37:05
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv27689/hibernate/sql Modified Files: Dialect.java Log Message: support [] quoted identifiers Index: Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/sql/Dialect.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Dialect.java 14 Dec 2002 09:27:55 -0000 1.42 --- Dialect.java 4 Mar 2003 14:37:00 -0000 1.43 *************** *** 49,53 **** * Characters used for quoting SQL identifiers */ ! public static final String QUOTE="`\""; --- 49,54 ---- * Characters used for quoting SQL identifiers */ ! public static final String QUOTE="`\"["; ! public static final String CLOSED_QUOTE="`\"]"; |
From: <one...@us...> - 2003-03-04 14:37:04
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/helpers In directory sc8-pr-cvs1:/tmp/cvs-serv27689/hibernate/helpers Modified Files: StringHelper.java Log Message: support [] quoted identifiers Index: StringHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/helpers/StringHelper.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** StringHelper.java 17 Jan 2003 08:52:27 -0000 1.20 --- StringHelper.java 4 Mar 2003 14:36:59 -0000 1.21 *************** *** 100,104 **** char quote = name.charAt(0); ! boolean nameEscaped = Dialect.QUOTE.indexOf(quote) > -1; StringBuffer nameBuffer = new StringBuffer(30); --- 100,105 ---- char quote = name.charAt(0); ! int quoteType = Dialect.QUOTE.indexOf(quote); ! boolean nameEscaped = quoteType > -1; StringBuffer nameBuffer = new StringBuffer(30); *************** *** 109,119 **** nameBuffer.append(name).append(suffix); } ! /*if (nameBuffer.length() > 15) { ! nameBuffer.delete(0, nameBuffer.length()-15); ! if ( !Character.isLetter( nameBuffer.charAt(0) ) ) nameBuffer.setCharAt(0, 'x'); ! }*/ if (nameEscaped) { nameBuffer.insert(0, quote); ! nameBuffer.append(quote); } return nameBuffer.toString(); --- 110,117 ---- nameBuffer.append(name).append(suffix); } ! if (nameEscaped) { nameBuffer.insert(0, quote); ! nameBuffer.append( Dialect.CLOSED_QUOTE.charAt(quoteType) ); } return nameBuffer.toString(); |
From: <one...@us...> - 2003-03-04 14:36:28
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util In directory sc8-pr-cvs1:/tmp/cvs-serv27494/sf/hibernate/util Modified Files: StringHelper.java Log Message: support [] quoted identifiers Index: StringHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util/StringHelper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** StringHelper.java 2 Feb 2003 06:41:06 -0000 1.7 --- StringHelper.java 4 Mar 2003 14:36:23 -0000 1.8 *************** *** 108,112 **** char quote = name.charAt(0); ! boolean nameEscaped = Dialect.QUOTE.indexOf(quote) > -1; StringBuffer nameBuffer = new StringBuffer(30); --- 108,113 ---- char quote = name.charAt(0); ! int quoteType = Dialect.QUOTE.indexOf(quote); ! boolean nameEscaped = quoteType > -1; StringBuffer nameBuffer = new StringBuffer(30); *************** *** 120,124 **** if (nameEscaped) { nameBuffer.insert(0, quote); ! nameBuffer.append(quote); } return nameBuffer.toString(); --- 121,125 ---- if (nameEscaped) { nameBuffer.insert(0, quote); ! nameBuffer.append( Dialect.CLOSED_QUOTE.charAt(quoteType) ); } return nameBuffer.toString(); |
From: <one...@us...> - 2003-03-04 14:36:27
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv27494/sf/hibernate/dialect Modified Files: Dialect.java Log Message: support [] quoted identifiers Index: Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/Dialect.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Dialect.java 1 Mar 2003 21:27:29 -0000 1.9 --- Dialect.java 4 Mar 2003 14:36:20 -0000 1.10 *************** *** 47,51 **** * Characters used for quoting SQL identifiers */ ! public static final String QUOTE="`\""; --- 47,52 ---- * Characters used for quoting SQL identifiers */ ! public static final String QUOTE="`\"["; ! public static final String CLOSED_QUOTE="`\"]"; |
From: <one...@us...> - 2003-03-04 14:14:52
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools In directory sc8-pr-cvs1:/tmp/cvs-serv18798/cirrus/hibernate/tools Added Files: SchemaExportTask.java SchemaUpdaterTask.java Log Message: schemaXXX Ant tasks (Cameron Braid) --- NEW FILE: SchemaExportTask.java --- package cirrus.hibernate.tools; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Properties; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import cirrus.hibernate.Datastore; import cirrus.hibernate.Hibernate; import cirrus.hibernate.HibernateException; import cirrus.hibernate.MappingException; import cirrus.hibernate.tools.SchemaExport; /** * * An Ant Task to provide a better interface to the SchemaExport than the java command line * * supports nested >fileset$lt; tags * * Designed to use the Hibernate pre version 2 <tt>cirrus.hibernate.tools.SchemaExport</tt>. * * @author <a href="mailto:ca...@da...">cameronbraid</a> * */ public class SchemaExportTask extends Task { /** input mapping files */ private List fileSets = new ArrayList(); /** the name of the hibernate properties file to use */ private File propertiesFile; /** the name of the output file for ddl statements */ private String outputFile; /** print sql commands to Standard out */ private boolean quiet = true; /** print out DDL only.. or export if false */ private boolean text = true; /** only drop the tables, don't create them */ private boolean drop; /** prety print the sql ddl */ private boolean formatSQL; /** the batch delimiter */ private String delimiter; /** add a FileSet to the list of file sets */ public void addFileset(FileSet set) { fileSets.add(set); } public void setQuiet(boolean quiet) { this.quiet = quiet; } public void setDrop(String drop) { this.drop = Boolean.valueOf(drop).booleanValue(); } public void setText(boolean text) { this.text = text; } public void setOutput(String output) { this.outputFile = output; } public void setFormat(String format) { this.formatSQL = Boolean.valueOf(format).booleanValue(); } public void setDelimiter(String delimiter) { this.delimiter = delimiter; } /** set the property file to use for configuring the Datastore */ public void setProperties(File propertiesFile) { if (!propertiesFile.exists()) { throw new BuildException("Properties file: " + propertiesFile + " does not exist."); } this.propertiesFile = propertiesFile; } private String[] getFiles() { List files = new LinkedList(); for ( Iterator i = fileSets.iterator(); i.hasNext(); ) { FileSet fs = (FileSet) i.next(); DirectoryScanner ds = fs.getDirectoryScanner(project); String[] dsFiles = ds.getIncludedFiles(); for (int j = 0; j < dsFiles.length; j++) { File f = new File(dsFiles[j]); if ( !f.isFile() ) { f = new File( ds.getBasedir(), dsFiles[j] ); } files.add( f.getAbsolutePath() ); } } return (String[]) files.toArray( new String[0] ); } private Datastore getDatastore() throws MappingException { Datastore ds = Hibernate.createDatastore(); // add all of the mapping files to the data store String[] files = getFiles(); for (int i = 0; i < files.length; i++) { String filename = files[i]; System.out.println("Adding mapping " + filename); if (filename.endsWith(".jar")) { ds.storeJar(filename); } else { ds.storeFile(filename); } } return ds; } public void execute() throws BuildException { try { Datastore ds = getDatastore(); SchemaExport schemaExport = getSchemaExport(ds); if (drop) { schemaExport.drop(!quiet, !text); } else { schemaExport.create(!quiet, !text); } } catch (HibernateException e) { throw new BuildException("Schema text failed: " + e.getMessage(), e); } catch (FileNotFoundException e) { throw new BuildException("File not found: " + e.getMessage(), e); } catch (IOException e) { throw new BuildException("IOException : " + e.getMessage(), e); } } private SchemaExport getSchemaExport(Datastore ds) throws HibernateException, IOException { SchemaExport schemaExport = null; if (propertiesFile == null) { schemaExport = new SchemaExport(ds); } else { Properties properties = new Properties(); properties.load( new FileInputStream(propertiesFile) ); schemaExport = new SchemaExport(ds, properties); } schemaExport.setOutputFile(outputFile); return schemaExport; } } --- NEW FILE: SchemaUpdaterTask.java --- package cirrus.hibernate.tools; import java.io.FileInputStream; import java.util.Properties; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import cirrus.hibernate.Datastore; import cirrus.hibernate.Hibernate; /** * * An Ant Task to provide a better interface to the SchemaUpdater than the java command line * * supports nested >fileset$lt; tags * * Designed to use the Hibernate 1.2 <tt>cirrus.hibernate.tools.SchemaUpdater.</tt> * * @author <a href="mailto:ca...@da...">cameronbraid</a> */ public class SchemaUpdaterTask extends Task { /** input mapping files */ private Path mappingFiles = new Path(getProject()); /** the name of the hibernate properties file to use */ private String properties; /** display the ddl commands */ private boolean script = true; /** add a configured FileSet to the list of mapping files */ public void addConfiguredFileSet( FileSet fileSet ) { mappingFiles.addFileset( fileSet ); } /** set the property file to use for configuring the Datastore */ public void setProperties(String properties) { this.properties = properties; } public void setQuiet(String quiet) { this.script = !Boolean.valueOf(quiet).booleanValue(); } public void setProject(Project project) { super.setProject(project); mappingFiles = new Path(project); } public void execute() throws BuildException { Datastore ds = Hibernate.createDatastore(); try { // add all of the mapping files to the data store String[] mapping = mappingFiles.list(); for (int i = 0; i < mapping.length; i++) { System.out.println("Adding mapping " + mapping[i]); if (mapping[i].endsWith(".jar")) { ds.storeJar(mapping[i]); } else { ds.storeFile(mapping[i]); } } } catch (Exception e) { e.printStackTrace(); throw new BuildException("could not load all mapping files",e); } try { if(properties!=null) { Properties props = new Properties(); props.load( new FileInputStream(properties) ); new SchemaUpdater(ds, props).execute(script); } else { new SchemaUpdater(ds).execute(script); } } catch (Exception e) { e.printStackTrace(); throw new BuildException("error updating schema", e); } } } |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv2690/sf/hibernate/impl Modified Files: QueryImpl.java ScheduledEntityAction.java SessionFactoryImpl.java SessionImpl.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: QueryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/QueryImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** QueryImpl.java 2 Mar 2003 09:02:39 -0000 1.8 --- QueryImpl.java 4 Mar 2003 10:53:46 -0000 1.9 *************** *** 69,85 **** } ! public void setMaxResults(int maxResults) { selection.setMaxRows(new Integer(maxResults)); } ! public void setTimeout(int timeout) { selection.setTimeout(new Integer(timeout)); } ! public void setFirstResult(int firstResult) { selection.setFirstRow(new Integer(firstResult)); } ! public void setParameter(int position, Object val, Type type) { int size = values.size(); if ( position<size ) { --- 69,88 ---- } ! public Query setMaxResults(int maxResults) { selection.setMaxRows(new Integer(maxResults)); + return this; } ! public Query setTimeout(int timeout) { selection.setTimeout(new Integer(timeout)); + return this; } ! public Query setFirstResult(int firstResult) { selection.setFirstRow(new Integer(firstResult)); + return this; } ! public Query setParameter(int position, Object val, Type type) { int size = values.size(); if ( position<size ) { *************** *** 95,270 **** types.add(type); } } ! public void setString(int position, String val) { setParameter(position, val, Hibernate.STRING); } ! public void setCharacter(int position, char val) { setParameter(position, new Character(val), Hibernate.CHARACTER); } ! public void setBoolean(int position, boolean val) { setParameter(position, new Boolean(val), Hibernate.BOOLEAN); } ! public void setByte(int position, byte val) { setParameter(position, new Byte(val), Hibernate.BYTE); } ! public void setShort(int position, short val) { setParameter(position, new Short(val), Hibernate.SHORT); } ! public void setInteger(int position, int val) { setParameter(position, new Integer(val), Hibernate.INTEGER); } ! public void setLong(int position, long val) { setParameter(position, new Long(val), Hibernate.LONG); } ! public void setFloat(int position, float val) { setParameter(position, new Float(val), Hibernate.FLOAT); } ! public void setDouble(int position, double val) { setParameter(position, new Double(val), Hibernate.DOUBLE); } ! public void setBinary(int position, byte[] val) { setParameter(position, val, Hibernate.BINARY); } ! public void setSerializable(int position, Serializable val) { setParameter(position, val, Hibernate.SERIALIZABLE); } ! public void setDate(int position, Date date) { setParameter(position, date, Hibernate.DATE); } ! public void setTime(int position, Date date) { setParameter(position, date, Hibernate.TIME); } ! public void setTimestamp(int position, Date date) { setParameter(position, date, Hibernate.TIMESTAMP); } ! public void setEntity(int position, Object val) { setParameter( position, val, Hibernate.association( val.getClass() ) ); } ! public void setEnum(int position, Object val) throws MappingException { setParameter( position, val, Hibernate.enum( val.getClass() ) ); } ! public void setLocale(int position, Locale locale) { setParameter(position, locale, Hibernate.LOCALE); } ! public void setCalendar(int position, Calendar calendar) { setParameter(position, calendar, Hibernate.CALENDAR); } ! public void setCalendarDate(int position, Calendar calendar) { setParameter(position, calendar, Hibernate.CALENDAR_DATE); } ! public void setBinary(String name, byte[] val) { setParameter(name, val, Hibernate.BINARY); } ! public void setBoolean(String name, boolean val) { setParameter(name, new Boolean(val), Hibernate.BOOLEAN); } ! public void setByte(String name, byte val) { setParameter(name, new Byte(val), Hibernate.BYTE); } ! public void setCharacter(String name, char val) { setParameter(name, new Character(val), Hibernate.CHARACTER); } ! public void setDate(String name, Date date) { setParameter(name, date, Hibernate.DATE); } ! public void setDouble(String name, double val) { setParameter(name, new Double(val), Hibernate.DOUBLE); } ! public void setEntity(String name, Object val) { setParameter( name, val, Hibernate.association( val.getClass() ) ); } ! public void setEnum(String name, Object val) throws MappingException { setParameter( name, val, Hibernate.enum( val.getClass() ) ); } ! public void setFloat(String name, float val) { setParameter(name, new Float(val), Hibernate.FLOAT); } ! public void setInteger(String name, int val) { setParameter(name, new Integer(val), Hibernate.INTEGER); } ! public void setLocale(String name, Locale locale) { setParameter(name, locale, Hibernate.LOCALE); } ! public void setCalendar(String name, Calendar calendar) { setParameter(name, calendar, Hibernate.CALENDAR); } ! public void setCalendarDate(String name, Calendar calendar) { setParameter(name, calendar, Hibernate.CALENDAR_DATE); } ! public void setLong(String name, long val) { setParameter(name, new Long(val), Hibernate.LONG); } ! public void setParameter(String name, Object val, Type type) { namedParameters.put(name, new TypedValue(type, val) ); } ! public void setSerializable(String name, Serializable val) { setParameter(name, val, Hibernate.SERIALIZABLE); } ! public void setShort(String name, short val) { setParameter(name, new Short(val), Hibernate.SHORT); } ! public void setString(String name, String val) { setParameter(name, val, Hibernate.STRING); } ! public void setTime(String name, Date date) { setParameter(name, date, Hibernate.TIME); } ! public void setTimestamp(String name, Date date) { setParameter(name, date, Hibernate.TIMESTAMP); } ! public void setBigDecimal(int position, BigDecimal number) { setParameter(position, number, Hibernate.BIG_DECIMAL); } ! public void setBigDecimal(String name, BigDecimal number) { setParameter(name, number, Hibernate.BIG_DECIMAL); } ! public void setParameter(int position, Object val) throws HibernateException { setParameter( position, val, guessType(val) ); } ! public void setParameter(String name, Object val) throws HibernateException { setParameter( name, val, guessType(val) ); } --- 98,317 ---- types.add(type); } + return this; } ! public Query setString(int position, String val) { setParameter(position, val, Hibernate.STRING); + return this; } ! public Query setCharacter(int position, char val) { setParameter(position, new Character(val), Hibernate.CHARACTER); + return this; } ! public Query setBoolean(int position, boolean val) { setParameter(position, new Boolean(val), Hibernate.BOOLEAN); + return this; } ! public Query setByte(int position, byte val) { setParameter(position, new Byte(val), Hibernate.BYTE); + return this; } ! public Query setShort(int position, short val) { setParameter(position, new Short(val), Hibernate.SHORT); + return this; } ! public Query setInteger(int position, int val) { setParameter(position, new Integer(val), Hibernate.INTEGER); + return this; } ! public Query setLong(int position, long val) { setParameter(position, new Long(val), Hibernate.LONG); + return this; } ! public Query setFloat(int position, float val) { setParameter(position, new Float(val), Hibernate.FLOAT); + return this; } ! public Query setDouble(int position, double val) { setParameter(position, new Double(val), Hibernate.DOUBLE); + return this; } ! public Query setBinary(int position, byte[] val) { setParameter(position, val, Hibernate.BINARY); + return this; } ! public Query setSerializable(int position, Serializable val) { setParameter(position, val, Hibernate.SERIALIZABLE); + return this; } ! public Query setDate(int position, Date date) { setParameter(position, date, Hibernate.DATE); + return this; } ! public Query setTime(int position, Date date) { setParameter(position, date, Hibernate.TIME); + return this; } ! public Query setTimestamp(int position, Date date) { setParameter(position, date, Hibernate.TIMESTAMP); + return this; } ! public Query setEntity(int position, Object val) { setParameter( position, val, Hibernate.association( val.getClass() ) ); + return this; } ! public Query setEnum(int position, Object val) throws MappingException { setParameter( position, val, Hibernate.enum( val.getClass() ) ); + return this; } ! public Query setLocale(int position, Locale locale) { setParameter(position, locale, Hibernate.LOCALE); + return this; } ! public Query setCalendar(int position, Calendar calendar) { setParameter(position, calendar, Hibernate.CALENDAR); + return this; } ! public Query setCalendarDate(int position, Calendar calendar) { setParameter(position, calendar, Hibernate.CALENDAR_DATE); + return this; } ! public Query setBinary(String name, byte[] val) { setParameter(name, val, Hibernate.BINARY); + return this; } ! public Query setBoolean(String name, boolean val) { setParameter(name, new Boolean(val), Hibernate.BOOLEAN); + return this; } ! public Query setByte(String name, byte val) { setParameter(name, new Byte(val), Hibernate.BYTE); + return this; } ! public Query setCharacter(String name, char val) { setParameter(name, new Character(val), Hibernate.CHARACTER); + return this; } ! public Query setDate(String name, Date date) { setParameter(name, date, Hibernate.DATE); + return this; } ! public Query setDouble(String name, double val) { setParameter(name, new Double(val), Hibernate.DOUBLE); + return this; } ! public Query setEntity(String name, Object val) { setParameter( name, val, Hibernate.association( val.getClass() ) ); + return this; } ! public Query setEnum(String name, Object val) throws MappingException { setParameter( name, val, Hibernate.enum( val.getClass() ) ); + return this; } ! public Query setFloat(String name, float val) { setParameter(name, new Float(val), Hibernate.FLOAT); + return this; } ! public Query setInteger(String name, int val) { setParameter(name, new Integer(val), Hibernate.INTEGER); + return this; } ! public Query setLocale(String name, Locale locale) { setParameter(name, locale, Hibernate.LOCALE); + return this; } ! public Query setCalendar(String name, Calendar calendar) { setParameter(name, calendar, Hibernate.CALENDAR); + return this; } ! public Query setCalendarDate(String name, Calendar calendar) { setParameter(name, calendar, Hibernate.CALENDAR_DATE); + return this; } ! public Query setLong(String name, long val) { setParameter(name, new Long(val), Hibernate.LONG); + return this; } ! public Query setParameter(String name, Object val, Type type) { namedParameters.put(name, new TypedValue(type, val) ); + return this; } ! public Query setSerializable(String name, Serializable val) { setParameter(name, val, Hibernate.SERIALIZABLE); + return this; } ! public Query setShort(String name, short val) { setParameter(name, new Short(val), Hibernate.SHORT); + return this; } ! public Query setString(String name, String val) { setParameter(name, val, Hibernate.STRING); + return this; } ! public Query setTime(String name, Date date) { setParameter(name, date, Hibernate.TIME); + return this; } ! public Query setTimestamp(String name, Date date) { setParameter(name, date, Hibernate.TIMESTAMP); + return this; } ! public Query setBigDecimal(int position, BigDecimal number) { setParameter(position, number, Hibernate.BIG_DECIMAL); + return this; } ! public Query setBigDecimal(String name, BigDecimal number) { setParameter(name, number, Hibernate.BIG_DECIMAL); + return this; } ! public Query setParameter(int position, Object val) throws HibernateException { setParameter( position, val, guessType(val) ); + return this; } ! public Query setParameter(String name, Object val) throws HibernateException { setParameter( name, val, guessType(val) ); + return this; } *************** *** 294,299 **** } ! public void setParameterList(String name, Collection vals, Type type) throws HibernateException { namedParameterLists.put( name, new TypedValue(type, vals) ); } --- 341,347 ---- } ! public Query setParameterList(String name, Collection vals, Type type) throws HibernateException { namedParameterLists.put( name, new TypedValue(type, vals) ); + return this; } *************** *** 325,330 **** ! public void setParameterList(String name, Collection vals) throws HibernateException { setParameterList(name, vals, guessType( vals.iterator().next() ) ); } --- 373,379 ---- ! public Query setParameterList(String name, Collection vals) throws HibernateException { setParameterList(name, vals, guessType( vals.iterator().next() ) ); + return this; } *************** *** 333,337 **** } ! public void setProperties(Object bean) throws HibernateException { Class clazz = bean.getClass(); Iterator iter = session.getFactory().getNamedParameters(queryString).iterator(); --- 382,386 ---- } ! public Query setProperties(Object bean) throws HibernateException { Class clazz = bean.getClass(); Iterator iter = session.getFactory().getNamedParameters(queryString).iterator(); *************** *** 344,347 **** --- 393,397 ---- catch (PropertyNotFoundException pnfe) {} } + return this; } Index: ScheduledEntityAction.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledEntityAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ScheduledEntityAction.java 2 Feb 2003 04:19:51 -0000 1.4 --- ScheduledEntityAction.java 4 Mar 2003 10:53:46 -0000 1.5 *************** *** 26,30 **** public final Serializable[] getPropertySpaces() { ! return persister.getPropertySpaces(instance); } --- 26,30 ---- public final Serializable[] getPropertySpaces() { ! return persister.getPropertySpaces(); } Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SessionFactoryImpl.java 22 Feb 2003 06:42:07 -0000 1.13 --- SessionFactoryImpl.java 4 Mar 2003 10:53:46 -0000 1.14 *************** *** 267,274 **** //Queries: ! querySubstitutions = PropertiesHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:", properties); log.info("Query language substitutions: " + querySubstitutions); ! queryImports = PropertiesHelper.toStringArray(Environment.QUERY_IMPORTS, " ,;:", properties); if ( queryImports.length!=0 ) log.info( "Query language imports: " + StringHelper.toString(queryImports) ); --- 267,274 ---- //Queries: ! querySubstitutions = PropertiesHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties); log.info("Query language substitutions: " + querySubstitutions); ! queryImports = PropertiesHelper.toStringArray(Environment.QUERY_IMPORTS, " ,;:\n\t\r\f", properties); if ( queryImports.length!=0 ) log.info( "Query language imports: " + StringHelper.toString(queryImports) ); *************** *** 540,545 **** public void closePreparedStatement(PreparedStatement ps) throws SQLException { if (statementCache!=null) { - ps.setMaxRows(0); - ps.setFetchSize(0); statementCache.closePreparedStatement(ps); } --- 540,543 ---- Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** SessionImpl.java 19 Feb 2003 02:02:10 -0000 1.22 --- SessionImpl.java 4 Mar 2003 10:53:46 -0000 1.23 *************** *** 52,56 **** --- 52,58 ---- import net.sf.hibernate.collection.ArrayHolder; import net.sf.hibernate.engine.*; + import net.sf.hibernate.loader.SearchLoader; import net.sf.hibernate.persister.ClassPersister; + import net.sf.hibernate.persister.Loadable; import net.sf.hibernate.proxy.*; import net.sf.hibernate.hql.QueryTranslator; *************** *** 2844,2847 **** --- 2846,2884 ---- } + public List find(Class persistentClass, Map propertyNameValues) + throws HibernateException { + + if ( log.isTraceEnabled() ) { + log.trace( "search: " + persistentClass.getName() ); + log.trace( "properties: " + propertyNameValues ); + } + + String[] propertyNames = new String[ propertyNameValues.size() ]; + Iterator iter = propertyNameValues.keySet().iterator(); + for ( int i=0; i<propertyNameValues.size(); i++ ) { + propertyNames[i] = (String) iter.next(); + } + Loadable persister = (Loadable) getPersister(persistentClass); + SearchLoader loader = new SearchLoader(persister, factory, propertyNames); + + Serializable[] spaces = persister.getPropertySpaces(); + Set set = new HashSet(); + for (int i=0; i<spaces.length; i++) set.add( spaces[i] ); + autoFlushIfRequired(set); + + dontFlushFromFind++; + try { + return loader.list(this, propertyNameValues); + } + catch (SQLException sqle) { + throw new JDBCException(sqle); + } + finally { + dontFlushFromFind--; + } + + } + + } |
From: <one...@us...> - 2003-03-04 10:53:51
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv2690/sf/hibernate/persister Modified Files: ClassPersister.java EntityPersister.java NormalizedEntityPersister.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: ClassPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/ClassPersister.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ClassPersister.java 9 Feb 2003 06:28:15 -0000 1.7 --- ClassPersister.java 4 Mar 2003 10:53:47 -0000 1.8 *************** *** 46,50 **** * instance are persisted. eg. table names. */ ! public Serializable[] getPropertySpaces(Object instance); /** --- 46,50 ---- * instance are persisted. eg. table names. */ ! public Serializable[] getPropertySpaces(); /** Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** EntityPersister.java 2 Mar 2003 06:58:51 -0000 1.19 --- EntityPersister.java 4 Mar 2003 10:53:47 -0000 1.20 *************** *** 214,218 **** } ! public Serializable[] getPropertySpaces(Object instance) { return tableNames; } --- 214,218 ---- } ! public Serializable[] getPropertySpaces() { return tableNames; } Index: NormalizedEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/NormalizedEntityPersister.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NormalizedEntityPersister.java 2 Mar 2003 06:58:52 -0000 1.12 --- NormalizedEntityPersister.java 4 Mar 2003 10:53:47 -0000 1.13 *************** *** 205,210 **** } ! public Serializable[] getPropertySpaces(Object instance) { ! return tableNames; } --- 205,210 ---- } ! public Serializable[] getPropertySpaces() { ! return tableNames; // don't need subclass tables, because they can't appear in conditions } |