Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type
In directory sc8-pr-cvs1:/tmp/cvs-serv12292/hibernate/type
Modified Files:
ObjectType.java
Log Message:
added meta-type to <any> mappings
Index: ObjectType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ObjectType.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ObjectType.java 8 Apr 2003 09:49:35 -0000 1.9
--- ObjectType.java 11 Apr 2003 07:15:54 -0000 1.10
***************
*** 21,32 ****
public class ObjectType extends AbstractType implements AbstractComponentType, AssociationType {
! private Type identifierType;
! public ObjectType(Type identifierType) {
! this.identifierType = identifierType;
}
public ObjectType() {
! this(Hibernate.SERIALIZABLE);
}
--- 21,34 ----
public class ObjectType extends AbstractType implements AbstractComponentType, AssociationType {
! private final Type identifierType;
! private final Type metaType;
! public ObjectType(Type metaType, Type identifierType) {
! this.identifierType = identifierType;
! this.metaType = metaType;
}
public ObjectType() {
! this(Hibernate.CLASS, Hibernate.SERIALIZABLE);
}
***************
*** 92,96 ****
//if ( names.length!=2 ) throw new HibernateException("object type mapping must specify exactly two columns");
! Class clazz = (Class) Hibernate.CLASS.nullSafeGet( rs, names[0] );
Serializable id = (Serializable) identifierType.nullSafeGet(rs, names[1], session, owner);
if (clazz==null || id==null) {
--- 94,98 ----
//if ( names.length!=2 ) throw new HibernateException("object type mapping must specify exactly two columns");
! Class clazz = (Class) metaType.nullSafeGet(rs, names[0], session, owner);
Serializable id = (Serializable) identifierType.nullSafeGet(rs, names[1], session, owner);
if (clazz==null || id==null) {
***************
*** 119,124 ****
}
! Hibernate.CLASS.nullSafeSet(st, clazz, index, session);
! identifierType.nullSafeSet(st, id, index+1, session);
}
--- 121,126 ----
}
! metaType.nullSafeSet(st, clazz, index, session);
! identifierType.nullSafeSet(st, id, index+1, session); // metaType must be single-column type
}
***************
*** 137,141 ****
public int[] sqlTypes(Mapping mapping) throws MappingException {
return ArrayHelper.join(
! Hibernate.CLASS.sqlTypes(mapping),
identifierType.sqlTypes(mapping)
);
--- 139,143 ----
public int[] sqlTypes(Mapping mapping) throws MappingException {
return ArrayHelper.join(
! metaType.sqlTypes(mapping),
identifierType.sqlTypes(mapping)
);
***************
*** 230,234 ****
public Type[] getSubtypes() {
! return new Type[] { Hibernate.CLASS, identifierType };
}
--- 232,236 ----
public Type[] getSubtypes() {
! return new Type[] { metaType, identifierType };
}
|