I'm having a caching problem. I update a record on one page, then access it on the next. When the record is accessed, the updates that were made are not present. I'm now trying to force a re-read from the database, but it's not working. Here's my code.
Code:
TrackingStep rootTracking = (TrackingStep)session.load(
TrackingStep.class, rootTrackingID, LockMode.READ);
When I run the application, it generates this in the logs.
Code:
Locking entity: [com.idex.processtracking.bean.TrackingStep#21]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select id from TrackingSteps where id =?
preparing statement
binding '21' to parameter: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
resolved object in session cache: [com.idex.processtracking.bean.TrackingStep#21]
The ID refresh is a little pointless ... But it's doing it, then it gets the object from session cache. Does anyone know why this is happening? This isn't the only place I'm having this problem.
Hibernate version: 3.0.5 Mapping documents:Code:
<hibernate-mapping>
<class name="com.idex.processtracking.bean.TrackingStep"
table="TrackingSteps">
<id column="id" name="id" type="integer">
<generator class="increment"/>
</id>
<many-to-one name="processStep" column="processStepID" not-null="true"
cascade="save-update" class="com.idex.processtracking.bean.ProcessStep"
/>
<many-to-one name="parentStep" column="parentStep"
cascade="all" class="com.idex.processtracking.bean.TrackingStep" />
<set name="childSteps" inverse="true" cascade="none">
<key column="parentStep" />
<one-to-many class="com.idex.processtracking.bean.TrackingStep" />
</set>
<many-to-one name="nextStep" column="nextStep" cascade="none"
class="com.idex.processtracking.bean.TrackingStep" />
<property name="startTime" column="startTime" type="timestamp"
not-null="true" />
<property name="endTime" column="endTime" type="timestamp" />
<many-to-one name="user" column="userName" cascade="none" not-null="true"
class="com.idex.processtracking.bean.User" />
<property name="description" column="description" type="string" />
<set name="authorizedUsers" lazy="true" inverse="true" cascade="none">
<key column="trackingID" />
<one-to-many class="com.idex.processtracking.bean.TrackingUser" />
</set>
<set name="textDetails" inverse="true" lazy="true" cascade="all">
<key column="trackingID" />
<one-to-many class="com.idex.processtracking.bean.TrackingTextDetail" />
</set>
</class>
</hibernate-mapping>
Name and version of the database you are using: SQL Server 2000