-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: hbm2hbmxml misorders version,property from annotations
PostPosted: Thu Jul 20, 2006 6:41 pm 
Newbie

Joined: Thu Jul 20, 2006 6:25 pm
Posts: 6
I'm trying to use the ant hbm2hbmxml task to generate mapping files from a set of annotated java sources. (This is a interim step in migrating fully to hibernate 3, first we're getting rid of XDoclet)

I get the mapping files generated, but they do not match the dtd and are not parsed correctly. The Dtd requires that the <version> element precede <property>, but the generated mapping file is as
<class>
<id/>
<property/>
<version/>
<property/>
</class>

| Here's the annotated superclass:
|-----------------
package com.mmodal.cds.persistence;

import java.util.Date;
import javax.persistence.*;


@MappedSuperclass
public abstract class PersistentValue2 {

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
public Long getIdentifier() { return id_; }
protected void setIdentifier(Long id) { id_ = id; }

@Version
@Column(name="Version")
public int getVersion() { return version_; }
public void setVersion(int version) { version_ = version;}

@Temporal(TemporalType.TIMESTAMP)
public Date getCreated() { return created_; }
public void setCreated(Date created) { created_ = created; }

private Long id_;
private int version_;
private Date created_;

}
|-----------------
| And here's the subclass:
|-----------------
package com.mmodal.cds.service.profile;

import javax.persistence.*;
import com.mmodal.cds.persistence.PersistentValue2;

@Entity
@Table(name="TestSubClass")
public class TestSubClass extends PersistentValue2 {

private String profileId_;

@Basic
protected String getProfileId() { return profileId_; }

protected void setProfileId(String profileId) { profileId_ = profileId; }
}

| -----------------
| And here's my hibernate.cfg.xml
| -----------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<mapping class="com.mmodal.cds.service.profile.TestSubClass" />
</session-factory>
</hibernate-configuration>




| -----------------
| And here's the resulting hbm.xml:
| -----------------
<?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 2006/07/20 06:22:45 by Hibernate Tools 3.2.0.beta6a -->
<hibernate-mapping>
<class name="com.mmodal.cds.service.profile.TestSubClass" table="TestSubClass" discriminator-value="TestSubClass">
<id name="identifier" type="java.lang.Long">
<column name="identifier" />
<generator class="seqhilo"></generator>
</id>
<property name="created" type="timestamp">
<column name="created" />
</property>
<version name="version" type="int">
<column name="Version" />
</version>
<property name="profileId" type="java.lang.String">
<column name="profileId" />
</property>
</class>
</hibernate-mapping>

_________________
Nate Franzen


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 20, 2006 7:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm weird - it should list the version first.

please report in jira with enough files to reproduce - thank you.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: re: hbm2hbmxml misorders version,property from annotations
PostPosted: Fri Jul 21, 2006 12:37 pm 
Newbie

Joined: Thu Jul 20, 2006 6:25 pm
Posts: 6
jira issue is http://opensource.atlassian.com/project ... se/HBX-708

_________________
Nate Franzen


Top
 Profile  
 
 Post subject: HibernateTools-3.2.0.200608062304-nightly
PostPosted: Mon Aug 07, 2006 12:55 pm 
Newbie

Joined: Thu Jul 20, 2006 6:25 pm
Posts: 6
Sorry to be a pain about this, but I'm not sure where the fix for HBX-708 has been applied. I downloaded the latest nightly build, HibernateTools-3.2.0.200608062304-nightly, and used the jars from "...plugins/org.hibernate.eclipse_3.2.0.200608062304-nightly/lib/..." My test case still fails, so I'm probably still using the wrong code. Can you tell me where to get the current correct versions?

Thanks,

_________________
Nate Franzen


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 2:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its fixed in hibernate-tools svn located in the HibernateExt project.

I haven't updated the plugins build with an updated jar yet, but look again tomorrow and it should be there.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.