[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-688) hbm2java is not generating the @Version annotation for the <version ...> element
Stephen Longo (JIRA)
noreply at atlassian.com
Tue Feb 6 06:21:43 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-688?page=comments#action_26000 ]
Stephen Longo commented on HBX-688:
-----------------------------------
Hi Max,
I have to admit: I never used junit or any kind of testing framework! :(
I tried having a look at tests already there, but couldn't really understand how to integrate validation for my code.
Hope you still appreciate the patch I've attached. BTW, please be aware that I'm a newbie so double check carefully my code! ;)
If somebody ever submits a test case for this patch, I'd like to see it (for future reference!).
Kindest regards,
Stephen Longo
> hbm2java is not generating the @Version annotation for the <version ...> element
> --------------------------------------------------------------------------------
>
> Key: HBX-688
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-688
> Project: Hibernate Tools
> Type: Bug
> Components: hbm2java
> Versions: 3.1.beta5
> Reporter: Sean Dawson
> Attachments: BasicPOJOClass.patch
>
>
> 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!
--
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.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list