Hi all,
I am using JBossCache 1.2, and when I make two consecutive updates on a joined-subclass object, JBossCache logs an error message. It seems that with a joined-subclass object, the first update removes the object from the cache and then the second update logs the error that the object could not be found on the cache.
The same doesn't happen if the object is not a subclass. I don't know if this issue is more related to Hibernate or JBossCache, but this seems to be the only forum that the two teams read.
Below is all (I hope) the necessary information:
Hibernate version: 2.1.6
Mapping documents:
Parent.hbm
<hibernate-mapping package="com.test">
<class name="Parent" table="parent">
<cache usage="transactional" />
<id
column="parent_id"
name="Id"
type="int"
>
<generator class="vm" />
</id>
<joined-subclass name="Child" proxy="Child" table="child">
<key column="child_id" />
<property name="Property1" column="property_1" type="string" not-null="true" />
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Child child = (Child) s.load(Child.class, new Integer(1));
child.setProperty1("old_property");
Transaction t = s.beginTransaction();
s.update(child);
t.commit();
child.setProperty1("new_property");
t = s.beginTransaction();
s.update(child);
t.commit();
Name and version of the database you are using: Oracle 10g
Debug level Hibernate log excerpt:
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.cache.TransactionalCache.get():
cache lookup: 1
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.cache.TransactionalCache.get():
cache miss
Hibernate: select child0_.child_id as parent_id0_, child0_.property_1 as property_1119_0_ from child child0_ inner join parent child0__1_ on child0_.child_id=child0__1_.parent_id where child0_.child_id=?
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.SQL.log():
select child0_.child_id as parent_id0_, child0_.property_1 as property_1119_0_ from child child0_ inner join parent child0__1_ on child0_.child_id=child0__1_.parent_id where child0_.child_id=?
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.loader.Loader.getRow():
result row: 1
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.initializeEntity():
resolving associations for [com.test.Child#1]
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.initializeEntity():
adding entity to second-level cache [com.test.Child#1]
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.cache.TransactionalCache.put():
caching: 1
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.initializeEntity():
done materializing entity [com.test.Child#1]
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections():
initializing non-lazy collections
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.transaction.JDBCTransaction.begin():
begin
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.transaction.JDBCTransaction.begin():
current autocommit status:false
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.transaction.JDBCTransaction.commit():
commit
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.flushEverything():
Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.SessionImpl.flushEverything():
Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.Printer.toString():
listing entities:
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.impl.Printer.toString():
com.test.Child{Id=1, Property1=old_property}
Hibernate: update child set property_1=? where child_id=?
DEBUG: 2004-12-20 18:09:40 net.sf.hibernate.SQL.log():
update child set property_1=? where child_id=?
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.cache.UpdateTimestampsCache.invalidate():
Invalidating space [child]
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.cache.UpdateTimestampsCache.invalidate():
Invalidating space [parent]
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.transaction.JDBCTransaction.begin():
begin
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.transaction.JDBCTransaction.begin():
current autocommit status:false
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.transaction.JDBCTransaction.commit():
commit
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.impl.SessionImpl.flushEverything():
Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.impl.SessionImpl.flushEverything():
Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.impl.Printer.toString():
listing entities:
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.impl.Printer.toString():
com.test.Child{Id=1, Property1=new_property}
Hibernate: update child set property_1=? where child_id=?
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.SQL.log():
update child set property_1=? where child_id=?
ERROR: 2004-12-20 18:09:41 org.jboss.cache.TreeCache: node //com/test/Parent/1 not found
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.cache.UpdateTimestampsCache.invalidate():
Invalidating space [child]
DEBUG: 2004-12-20 18:09:41 net.sf.hibernate.cache.UpdateTimestampsCache.invalidate():
Invalidating space [parent]
Thanks,
Felipe
|