From: <one...@us...> - 2002-12-25 01:02:20
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv25620/hibernate/type Modified Files: EntityType.java OneToOneType.java TimestampType.java Type.java Log Message: fixed a bug caching null one-to-one associations Index: EntityType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/EntityType.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** EntityType.java 26 Oct 2002 16:43:27 -0000 1.13 --- EntityType.java 25 Dec 2002 01:02:16 -0000 1.14 *************** *** 96,102 **** else { Serializable id = session.getID(value); ! if (id ==null) { ! throw new AssertionFailure("null id"); ! } return id; } --- 96,100 ---- else { Serializable id = session.getID(value); ! if (id==null) throw new AssertionFailure("cannot cache a reference to an object with a null id"); return id; } *************** *** 118,121 **** --- 116,126 ---- return resolveIdentifier( hydrate(rs, names, session, owner), session ); } + + public abstract Object hydrate( + ResultSet rs, + String[] names, + SessionImplementor session, + Object owner) + throws HibernateException, SQLException; } Index: OneToOneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/OneToOneType.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** OneToOneType.java 20 Oct 2002 08:13:12 -0000 1.11 --- OneToOneType.java 25 Dec 2002 01:02:16 -0000 1.12 *************** *** 64,67 **** --- 64,69 ---- public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException { + + if (value==null) return null; Class clazz = getPersistentClass(); Index: TimestampType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/TimestampType.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** TimestampType.java 19 Dec 2002 11:29:03 -0000 1.32 --- TimestampType.java 25 Dec 2002 01:02:16 -0000 1.33 *************** *** 46,49 **** --- 46,57 ---- if (x==null || y==null) return false; + /*if ( + x instanceof Timestamp && + y instanceof Timestamp && + ( (Timestamp) x ).getNanos() != ( (Timestamp) y ).getNanos() + ) return false; + + return ( (java.util.Date) x ).getTime()==( (java.util.Date) y ).getTime();*/ + long xTime = ( (java.util.Date) x ).getTime(); long yTime = ( (java.util.Date) y ).getTime(); Index: Type.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/Type.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Type.java 24 Oct 2002 10:04:29 -0000 1.39 --- Type.java 25 Dec 2002 01:02:16 -0000 1.40 *************** *** 186,190 **** /** ! * Reconstruct the object from its cached "diassembled" state. * @param cached the disassembled state from the cache * @param session the session --- 186,190 ---- /** ! * Reconstruct the object from its cached "disassembled" state. * @param cached the disassembled state from the cache * @param session the session |