[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-231?page=co...
]
Frank Ulbricht commented on EJB-231:
------------------------------------
I still have this problem with version 3.2.0.cr4
hibernate3.jar in JBoss 4.0.5.GA, MANIFEST.MF:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.4.2_11-b06 (Sun Microsystems Inc.)
Implementation-Title: Hibernate3
Implementation-Version: 3.2.0.cr4
Implementation-Vendor:
hibernate.org
Hibernate-Version: 3.2.0.cr4
I have a simple Entity with an id, name and a version field:
@Entity(name = "Device")
public class DeviceEntityImpl implements DeviceEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private Integer version;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Version
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
From a remote client I use a SessionBean method like this:
public DeviceEntity updateDevice(DeviceEntity device) {
return this.em.merge(device);
}
The client just finds an entity by id, then changes the name and calls this method. To
produce an optimistic lock error the client ignores ghe return value, changes the name
again and calls the method with the same entity. In my opinion this should result in an
OptimisticLockException, but this is waht I get:
java.lang.IllegalArgumentException: id to load is required for loading
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:51)
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:33)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:792)
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at
org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:236)
at
org.jboss.ejb3.entity.TransactionScopedEntityManager.merge(TransactionScopedEntityManager.java:181)
...
Is the bug really fixed?
Optimistic locking exception could lead to
java.lang.IllegalArgumentException: id to load is required for loading
-----------------------------------------------------------------------------------------------------------------
Key: EJB-231
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-231
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Reporter: Emmanuel Bernard
Assignee: Emmanuel Bernard
Fix For: 3.2.0.cr3
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira