Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv27355/src/net/sf/hibernate/impl
Modified Files:
QueryImpl.java
Log Message:
include hibernate.properties in src dir
fix classpaths of batch scripts
Query.setEntity(), etc now proxy-aware
Query.guessType() now handles serializable entities properly
Index: QueryImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/QueryImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** QueryImpl.java 9 Mar 2003 04:04:08 -0000 1.10
--- QueryImpl.java 12 Mar 2003 12:28:58 -0000 1.11
***************
*** 24,27 ****
--- 24,29 ----
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.engine.TypedValue;
+ import net.sf.hibernate.proxy.HibernateProxyHelper;
+ import net.sf.hibernate.type.SerializableType;
import net.sf.hibernate.type.Type;
import net.sf.hibernate.type.TypeFactory;
***************
*** 172,176 ****
}
! public Query setEntity(int position, Object val) {
setParameter( position, val, Hibernate.association( val.getClass() ) );
return this;
--- 174,179 ----
}
! public Query setEntity(int position, Object val) throws HibernateException {
! val = HibernateProxyHelper.unproxy(val, session);
setParameter( position, val, Hibernate.association( val.getClass() ) );
return this;
***************
*** 227,231 ****
}
! public Query setEntity(String name, Object val) {
setParameter( name, val, Hibernate.association( val.getClass() ) );
return this;
--- 230,235 ----
}
! public Query setEntity(String name, Object val) throws HibernateException {
! val = HibernateProxyHelper.unproxy(val, session);
setParameter( name, val, Hibernate.association( val.getClass() ) );
return this;
***************
*** 318,321 ****
--- 322,326 ----
private Type guessType(Object param) throws HibernateException {
+ param = HibernateProxyHelper.unproxy(param, session);
Class clazz = param.getClass();
return guessType(clazz);
***************
*** 325,338 ****
String typename = clazz.getName();
Type type = TypeFactory.hueristicType(typename);
! if (type==null ) {
try {
session.getFactory().getPersister(clazz);
}
catch (MappingException me) {
! throw new HibernateException("Could not determine a type for class: " + typename);
}
! type = Hibernate.association(clazz);
}
- return type;
}
--- 330,351 ----
String typename = clazz.getName();
Type type = TypeFactory.hueristicType(typename);
! boolean serializable = type!=null && type instanceof SerializableType;
! if (type==null || serializable) {
try {
session.getFactory().getPersister(clazz);
}
catch (MappingException me) {
! if (serializable) {
! return type;
! }
! else {
! throw new HibernateException("Could not determine a type for class: " + typename);
! }
}
! return Hibernate.association(clazz);
! }
! else {
! return type;
}
}
***************
*** 384,387 ****
--- 397,401 ----
public Query setProperties(Object bean) throws HibernateException {
+ bean = HibernateProxyHelper.unproxy(bean, session);
Class clazz = bean.getClass();
Iterator iter = session.getFactory().getNamedParameters(queryString).iterator();
|