-->
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.  [ 6 posts ] 
Author Message
 Post subject: Generated Java code type for volume is "Short", no
PostPosted: Fri Apr 01, 2005 4:54 pm 
Newbie

Joined: Mon Mar 14, 2005 12:06 pm
Posts: 6
How come the generated Java code for "volume" is "Short" and not "short"?

Thanks.

Lou.

Hibernate version:

3.0rc1

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="com.oreilly.hh.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from Hibernate)
</meta>

<id name="id" type="int" column="TRACK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>

<property name="title" type="string">
<meta attribute="use-in-tostring">true</meta>
<column name="TITLE" not-null="true" index="TRACK_TITLE"/>
</property>

<property name="filePath" type="string" not-null="true"/>

<property name="playTime" type="time">
<meta attribute="field-description">Playing time</meta>
</property>

<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>

<property name="volume" type="short" not-null="true">
<meta attribute="field-description">How loud to play the track</meta>
</property>

</class>

<query name="com.oreilly.hh.tracksNoLongerThan">
<![CDATA[
from com.oreilly.hh.Track as track
where track.playTime <= :length
]]>
</query>

</hibernate-mapping>

Generated Java code

package com.oreilly.hh;

import java.io.Serializable;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
* Represents a single playable track in the music database.
* @author Jim Elliott (with help from Hibernate)
*
*/
public class Track implements Serializable {

/** nullable persistent field */
private String title;

/** nullable persistent field */
private String filePath;

/** nullable persistent field */
private java.util.Date playTime;

/** nullable persistent field */
private java.util.Date added;

/** nullable persistent field */
private Short volume;

/** full constructor */
public Track(String title, String filePath, java.util.Date playTime, java.util.Date added, Short volume) {
this.title = title;
this.filePath = filePath;
this.playTime = playTime;
this.added = added;
this.volume = volume;
}

/** default constructor */
public Track() {
}

public String getTitle() {
return this.title;
}

public void setTitle(String title) {
this.title = title;
}

public String getFilePath() {
return this.filePath;
}

public void setFilePath(String filePath) {
this.filePath = filePath;
}

/**
* Playing time
*/
public java.util.Date getPlayTime() {
return this.playTime;
}

public void setPlayTime(java.util.Date playTime) {
this.playTime = playTime;
}

/**
* When the track was created
*/
public java.util.Date getAdded() {
return this.added;
}

public void setAdded(java.util.Date added) {
this.added = added;
}

/**
* How loud to play the track
*/
public Short getVolume() {
return this.volume;
}

public void setVolume(Short volume) {
this.volume = volume;
}

public String toString() {
return new ToStringBuilder(this)
.append("title", getTitle())
.toString();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 02, 2005 3:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you dont report versions very clearly.

hibernate version 3.0rc
mapping file: 2.0
code generated: hibernate 2

you should use hibernate 3 mapping files and code generator.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: mapping and jar now consistent; same problem.
PostPosted: Mon Apr 04, 2005 10:28 am 
Newbie

Joined: Mon Mar 14, 2005 12:06 pm
Posts: 6
Thanks for your suggestion. I can't seem to get around this problem, which is likely my error but I don't see it. I'm expecting the generated code to use "short" not "Short". I'm now using:

hibernate version 3.0 final
mapping file: 3.0

Here's the revised 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">

<hibernate-mapping>

<class name="com.oreilly.hh.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from Hibernate)
</meta>

<id name="id" type="int" column="TRACK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>

<property name="title" type="string">
<meta attribute="use-in-tostring">true</meta>
<column name="TITLE" not-null="true" index="TRACK_TITLE"/>
</property>

<property name="filePath" type="string" not-null="true"/>

<property name="playTime" type="time">
<meta attribute="field-description">Playing time</meta>
</property>

<set name="comments" table="TRACK_COMMENTS">
<key column="TRACK_ID"/>
<element column="COMMENT" type="string"/>
</set>

<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>

<property name="volume" type="short" not-null="true">
<meta attribute="field-description">How loud to play the track</meta>
</property>

</class>

<query name="com.oreilly.hh.tracksNoLongerThan">
<![CDATA[
from com.oreilly.hh.Track as track
where track.playTime <= :length
]]>
</query>

</hibernate-mapping>

Here's the generated code:

package com.oreilly.hh;

import java.io.Serializable;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
* Represents a single playable track in the music database.
* @author Jim Elliott (with help from Hibernate)
*
*/
public class Track implements Serializable {

/** nullable persistent field */
private String title;

/** nullable persistent field */
private String filePath;

/** nullable persistent field */
private java.util.Date playTime;

/** nullable persistent field */
private java.util.Set comments;

/** nullable persistent field */
private java.util.Date added;

/** nullable persistent field */
private Short volume;

/** full constructor */
public Track(String title, String filePath, java.util.Date playTime, java.util.Set comments, java.util.Date added, Short volume) {
this.title = title;
this.filePath = filePath;
this.playTime = playTime;
this.comments = comments;
this.added = added;
this.volume = volume;
}

/** default constructor */
public Track() {
}

public String getTitle() {
return this.title;
}

public void setTitle(String title) {
this.title = title;
}

public String getFilePath() {
return this.filePath;
}

public void setFilePath(String filePath) {
this.filePath = filePath;
}

/**
* Playing time
*/
public java.util.Date getPlayTime() {
return this.playTime;
}

public void setPlayTime(java.util.Date playTime) {
this.playTime = playTime;
}

public java.util.Set getComments() {
return this.comments;
}

public void setComments(java.util.Set comments) {
this.comments = comments;
}

/**
* When the track was created
*/
public java.util.Date getAdded() {
return this.added;
}

public void setAdded(java.util.Date added) {
this.added = added;
}

/**
* How loud to play the track
*/
public Short getVolume() {
return this.volume;
}

public void setVolume(Short volume) {
this.volume = volume;
}

public String toString() {
return new ToStringBuilder(this)
.append("title", getTitle())
.toString();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 10:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
known bug in current hbm2java...will be fixed in alpha3

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: bug
PostPosted: Mon Apr 04, 2005 10:59 am 
Newbie

Joined: Mon Mar 14, 2005 12:06 pm
Posts: 6
Once again, thanks for your reply. I apologize for my ignorance in advance: I think I'm using hibernate 3.0 final version, and nothing more. So where do I monitor for the availability of the bug fix?

Thanks.

Lou.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 11:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://opensource.atlassian.com/project ... se/HBX-178

_________________
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.  [ 6 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.