Hi,
i use hibernate as the persistence provider in the current sun glassfish (ejb3-container). Hibernate does modify the entity by ONLY calling the getter of the BLOB-field:
A stateless session beans find an entity (= make it managed) and do the following tests:
a) If i do NOT call the getter of the BLOB field from the managed entity, the prePersist() will not called, means, the entity will not updated. (Correct behavior)
b) If i call the getter of the BLOB (LOB) field from a manged entity, hibernate will update the managed entity in the database (and the version field increments). INCORRECT behavior !
Why does hibernate update the entity if i yust call the getter of the BLOB field ? Could somebody help me to track down this problem ? Does i miss something ?
Code:
@Entity
public class SCXMLExecutorValue implements Serializable {
@Lob
@Column(length = 1000000)
private Serializable scxmlExecutor;
@Version
@Column(name = "OPTLOCK")
private Long version;
public SCXMLExecutor getScxmlExecutor() {
return (SCXMLExecutor) scxmlExecutor;
}
public void setScxmlExecutor(SCXMLExecutor scxmlExecutor) {
this.scxmlExecutor = scxmlExecutor;
}
@PostPersist
public void postPersist() {
Logger log = Logger.getLogger(SCXMLExecutor.class);
log.info("postPersist(): scxmlExecutorId: " + id);
}
... other setter and getter
}
Versions i use:
Code:
hibernate-entitymanager 3.4.0.GA
hibernate-annotations 3.4.0.GA
hibernate-commons-annotations 3.1.0.GA
hibernate-core by hibernate 3.3.0.SP1