-->
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.  [ 4 posts ] 
Author Message
 Post subject: hbm2java pojos have incorrect annotation
PostPosted: Sun Jan 21, 2007 11:10 pm 
Newbie

Joined: Sun Jan 21, 2007 10:56 pm
Posts: 14
hi guys,

I run into an odd problem.

We are using hbm2java target to autogenerate Hibernate mappings and beans from the database.

I seem to have issue with the PoJo generated.

I expect the annotation for a getter method to look like below:

/**
* @hibernate.id
* generator-class="assigned"
* type="java.lang.String"
* column="ORG_UNIT_SYS_ID"
*
*/
public String getOrgUnitSysId() {
return this.orgUnitSysId;
}


However, I am getting this instead:

/**
* @hibernate.property
* column="ORG_UNIT_SYS_ID"
* length="80"
*
*/
public String getOrgUnitSysId() {
return this.orgUnitSysId;
}

The database script used to create the table:
CREATE TABLE ORG_UNIT
(
ORG_UNIT_SYS_ID VARCHAR2(80 BYTE) NOT NULL,
ORG_UNIT_CODE VARCHAR2(8 BYTE),
REF_ORG_UNIT_CODE VARCHAR2(8 BYTE),
ORG_UNIT_DESC VARCHAR2(200 BYTE),
LEAVE_TYPE_CODES VARCHAR2(4000 BYTE)
)

I am using a very simple code generation configuration in hbm2java.config

<codegen>
<meta attribute="scope-field">protected</meta>
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
</codegen>

Could someone help me out? Am I missing something obvious here?

Thanks,

pali


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 2:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
these annotations are xdoclet comments and are all generated by middlegen (which then tells hbm2java to generate the java). so you need
to look at the middlegen part.

More apropriate forum is ithe toos forum.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 2:40 am 
Newbie

Joined: Sun Jan 21, 2007 10:56 pm
Posts: 14
thanks Max.

Yes, the middlegen target is called to generate a flat mapping. And for the table, I got the following entry:

hibernate.tables.ORG_UNIT.base-class-name=OrgUnit
hibernate.tables.ORG_UNIT.columns.LEAVE_TYPE_CODES.java-name=leaveTypeCodes
hibernate.tables.ORG_UNIT.columns.LEAVE_TYPE_CODES.java-type=java.lang.String
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_CODE.java-name=orgUnitCode
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_CODE.java-type=java.lang.String
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_DESC.java-name=orgUnitDesc
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_DESC.java-type=java.lang.String
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_SYS_ID.java-name=orgUnitSysId
hibernate.tables.ORG_UNIT.columns.ORG_UNIT_SYS_ID.java-type=java.lang.String
hibernate.tables.ORG_UNIT.columns.REF_ORG_UNIT_CODE.java-name=refOrgUnitCode
hibernate.tables.ORG_UNIT.columns.REF_ORG_UNIT_CODE.java-type=java.lang.String

The middlegen target itself is pretty straight forward, the prefsdir is where the properties file for middlegen.

<middlegen
appname="ProjectA"
gui="false"
prefsdir="${target.core.middlegenprefs}"

databaseurl="${environment.database.url}"
driver="${environment.database.driver}"
username="${environment.database.user}"
password="${environment.database.password}"
schema="${environment.database.schema}"
catalog="${environment.database.catalog}">


<!-- Plugins -->

<hibernate
destination="${target.core.hibernatemappings}"
package="${target.middlegen.package}"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
genXDocletTags="true"/>

**** list of tables ******

</middlegen>

Is there something wrong here that could cause middlegen to throw a fit?


thanks,

pali


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 4:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i'm not in to middlegen - you got a better chance if you post in the tools forum where David also hangs out.

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