-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: hibernate-reveng.xml
PostPosted: Sat Sep 24, 2005 1:05 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
Below is my hibernate-reveng.xml. However, my POJOS are getting Long and Integer and not the primitive long and int.

Anyone knows why?

Thanks,

<hibernate-reverse-engineering>

<type-mapping>
<sql-type jdbc-type="BIGINT" hibernate-type="long" />
<sql-type jdbc-type="INTEGER" hibernate-type="integer"/>
<sql-type jdbc-type="TINYINT" hibernate-type="byte"/>
<sql-type jdbc-type="SMALLINT" hibernate-type="short"/>
<sql-type jdbc-type="VARCHAR" hibernate-type="java.lang.String" />
</type-mapping>
</hibernate-reverse-engineering>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 24, 2005 6:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
because the tools currently uses type.getReturnedClass() which for primitives will give you the Object version. This was done for consistency across all types including usertypes.

We might introduce the special behavior that if the typename is a primitive name (e.g. int, long, etc.) we will use the primitive version (but need to be a special rule since e.g. binary or big_decimal would not be good ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 24, 2005 11:02 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
because the tools currently uses type.getReturnedClass() which for primitives will give you the Object version. This was done for consistency across all types including usertypes.

We might introduce the special behavior that if the typename is a primitive name (e.g. int, long, etc.) we will use the primitive version (but need to be a special rule since e.g. binary or big_decimal would not be good ;)


Maybe for the next release ??? :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 24, 2005 12:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
contribute a patch that works and you bet ,)

-max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 12:14 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
contribute a patch that works and you bet ,)

-max


I truly wish I could contribute a patch. Anyway, is it currently possible to use the Ant task and generate POJOs with a name prefix? Like BaseEmployee instead of just Employee and BaseEmployer instead of just Employer?

I am thinking about mucking with java.vm, but not sure how that will mess up the auto-generated mapping files...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 2:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
currently you can specify it per class with <meta attribute="generated-class">.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 10:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i just committed a fix that makes the tool take the literal primitive type, if you really want the object version then write the object version there or use the meta attribute ... i think that will do what people expect.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 11:49 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
currently you can specify it per class with <meta attribute="generated-class">.


In which ANT task should I specify this meta attribute? hbm2java or in cfg2hbm or both?

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 12:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its specified in the hbm.xml file.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 11:09 pm 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
its specified in the hbm.xml file.


I was thinking about something like the below...

codegen.xml:

<codegen>
<generate prefix="Base" renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer">
<param name="generate-concrete-empty-classes">true</param>
<param name="baseclass-prefix">Base</param>
</generate>
</codegen>

I used to call hbm2java like below:

build.xml:

<hbm2java config="codegen.xml"
output="${build.gen-src.java.dir}">
<fileset dir="${build.gen-src.hibernate.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>

Is that still possible?

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 11:10 pm 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
i just committed a fix that makes the tool take the literal primitive type, if you really want the object version then write the object version there or use the meta attribute ... i think that will do what people expect.


Max,

I really appreciate your efforts. I've asked for help before and you have always been most helpful and always ready to help!

Thanks again!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 1:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
see the docs on tools.hibernate.org about how the tools work for h3.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 1:13 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
see the docs on tools.hibernate.org about how the tools work for h3.


I must be thick or the docs need to be updated :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 2:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we dont have the base prefix for everything feature at the moment in the h3 tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 9:08 am 
Newbie

Joined: Mon Sep 26, 2005 8:43 am
Posts: 16
Max writes:
Quote:
i just committed a fix that makes the tool take the literal primitive type, if you really want the object version then write the object version there or use the meta attribute ... i think that will do what people expect.

Hey Max, I am making use of hibernate-tools-3.1.0.alpha5 which was released one month back. It would be great if you can tell me when can i expect this fix in a Distribution.

_________________
--Beejal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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.