I apologize for using this thread for posting my question. This subject closely matches my current issue.
I am fairly new to Hibernate, so maybe this is an easy one for the pros.
This applies to all my varchar2 (Oracle) fields in my app.
I have a field, mapped as
Code:
@Column(name = "MODEL_DESCRIPTION")
public String getModelDescription() {
return this.modelDescription;
}
public void setModelDescription(String modelDescription) {
this.modelDescription = modelDescription;
}
This field may have null values.
My Seam page
Code:
<h:inputText id="itemModelDescription"
value="#{itemHome.instance.modelDescription}"/>
other fields ...
If I change any other values on my page with #{itemHomeitemHome.update}, everything works fine. After update modelDescription is still null in the db.
The problem I have is that when I first load my entity and make NO changes, Hibernate issues an unnecessary update.
The update statement I see is
Code:
update
ITEM
set
DATE_MODIFIED=?,
VERSION_ID=?,
MODEL_DESCRIPTION=?
where
ITEM_ID=?
and VERSION_ID=?
date_modified is from MappedSuperClass field
Debugging, it looks like at some points setModelDescription sets "" into the field making Hibernate believe the data is dirty triggering an update.
Thanks in advance for any help.
My first post this year so a very Happy New Year to the Hibernate team and other users!
Franco