I am running tests out of the "Hibernate - A Developer's Notebook" and there is a Track class that has a few attributes and I updated one of those attributes (volume) within a session, after I have queried for all the Track classes within the database. With dirty checking, are all the fields supposed to show up in the update statement or is just the field that is modified? And is this occurring because I have not modified my configuration correctly?
SQL OUTPUT:
Code:
Hibernate: select track0_.TRACK_ID as TRACK_ID, track0_.title as title, track0_.filePath as filePath, track0_.playTime as playTime, track0_.added as added, track0_.volume as volume from TRACK track0_ where (track0_.volume<=? )
Hibernate: update TRACK set title=?, filePath=?, playTime=?, added=?, volume=? where TRACK_ID=?
Hibernate: update TRACK set title=?, filePath=?, playTime=?, added=?, volume=? where TRACK_ID=?
Hibernate: update TRACK set title=?, filePath=?, playTime=?, added=?, volume=? where TRACK_ID=?
Mapping FileCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.oreilly.hh.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from Hibernate)
</meta>
<id name="id" type="int" column="TRACK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="title" type="string" not-null="true"/>
<property name="filePath" type="string" not-null="true"/>
<property name="playTime" type="time">
<meta attribute="field-description">Playing time</meta>
</property>
<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>
<property name="volume" type="short" not-null="true">
<meta attribute="field-description">How loud to play the track</meta>
</property>
</class>
<query name="com.oreilly.hh.tracksNoLongerThan">
<![CDATA[
from com.oreilly.hh.Track as track
where track.playTime <= :length
]]>
</query>
<query name="com.oreilly.hh.tracksNoLouderThan">
<![CDATA[
from com.oreilly.hh.Track as track
where track.volume <= :volume
]]>
</query>
</hibernate-mapping>
Thanks
-jay
[/b]