Duplicate
Details
Assignee
UnassignedUnassignedReporter
SeanSSeanSBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Eric AmramMax Rydahl AndersenSeanSxsertyNComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
SeanS
SeanSBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Eric Amram
Max Rydahl Andersen
SeanS
xsertyN
Components
Affects versions
Priority
Created June 16, 2006 at 9:25 PM
Updated June 4, 2007 at 3:00 PM
Resolved June 4, 2007 at 3:00 PM
See http://forum.hibernate.org/viewtopic.php?p=2310547#2310547
Given a mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 13, 2006 3:27:21 PM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="Sample" table="Sample">
<id name="id" type="java.lang.Long">
<column name="id" />
<generator class="native" />
</id>
<version name="version" column="version"/>
<property name="value" column="value" type="string"/>
</class>
</hibernate-mapping>
the following ejb is generated (via hbm2java, ejb3="true", jdk5="true":
// default package
// Generated Jun 16, 2006 3:23:35 PM by Hibernate Tools 3.1.0.beta5
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
Sample generated by hbm2java
*/
@Entity
@Table(name="Sample"
)
public class Sample implements java.io.Serializable {
// Fields
private Long id;
private Integer version;
private String value;
// Constructors
/** default constructor */
public Sample() {
}
/** full constructor */
public Sample(String value) {
this.value = value;
}
// Property accessors
@Id @GeneratedValue
@Column(name="id", unique=false, nullable=false, insertable=true, updatable=true)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name="version", unique=false, nullable=false, insertable=true, updatable=true)
public Integer getVersion() {
return this.version;
}
public void setVersion(Integer version) {
this.version = version;
}
@Column(name="value", unique=false, nullable=true, insertable=true, updatable=true)
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
There should be a @Version annotation on the version property!