-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm2java is not creating my inner class
PostPosted: Mon Aug 16, 2004 12:55 pm 
Newbie

Joined: Fri Aug 13, 2004 12:06 pm
Posts: 15
Hibernate version: 2.1.4

Mapping documents: included

Code between sessionFactory.openSession() and session.close(): n/a

Full stack trace of any exception that occurs:

Name and version of the database you are using: n/a

Debug level Hibernate log excerpt: n/a


My mapping file specifies to generate an inner class by using the Foo$Bar notation as stated in the Hibernate manual, however, when I run hbm2java, it is generating the class as a separate file, with the name given and the desied outer class is not referring to it as Id.

My RecordingBean$Id class is not being generated inside my RecordingBean class... What am I doing wrong? Here are excerpts from the files:

Mapping file:

<hibernate-mapping schema="weblogic" package="relationships">

<class name="RecordingBean" table="RECORDING" lazy="true">

<meta attribute="class-description">
This JavaBean class is for interacting with the RECORDING
table.
@author Me
</meta>
<composite-id name="id" class="RecordingBean$Id" unsaved-value="any">
<key-property name="bandname" type="string" column="BANDNAME">
<meta attribute="field-description">Returns band's name.</meta>
<meta attribute="use-in-tostring">true</meta>
</key-property>
<key-property name="title" type="string" column="TITLE">
<meta attribute="field-description">Returns recording name.</meta>
<meta attribute="use-in-tostring">true</meta>
</key-property>
</composite-id>


Ant task to generate the file:

<java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator">
<arg value="${src.dir}/relationships/RecordingBean.hbm.xml"/>
<classpath refid="compile.classpath"/>
</java>


Output files generated:

package relationships;

import RecordingBean$Id;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
* This JavaBean class is for interacting with the RECORDING
* table.
* @author Me
*
*/
public class RecordingBean implements Serializable {

/** identifier field */
private RecordingBean$Id id;

...
}


package relationships;

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


/**
* This JavaBean class is for interacting with the RECORDING
* table.
* @author Me
*
*/
public class RecordingBean$Id implements Serializable {

/** identifier field */
private String bandname;

/** identifier field */
private String title;

/** full constructor */
public RecordingBean$Id(String bandname, String title) {
this.bandname = bandname;
this.title = title;
}

/** default constructor */
public RecordingBean$Id() {
}

...
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 6:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
add it to the Jira

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