-->
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: hbm2java and non-primitive types
PostPosted: Mon May 29, 2006 1:26 pm 
Newbie

Joined: Mon May 29, 2006 1:12 pm
Posts: 3
Hi,

I have been using Hibernate 3.0.5 and tools for a long time and as it has been working really well, I am only now looking to upgrade.

I have installed Hibernate 3.1.3 and Hibernate tools 3.1.0 beta 5. After the upgrade I find that the pojo code generated by hbm2java has changed fundamentally as the generated code now uses primitive java types instead of the objects, ie long instead of Long and int instead of Integer. This causes problems in my code as I no longer have anyway of dealing with NULL.

Browsing throught this forum it appears that the subject has been covered before however I am still confused as to whether this is a bug or the way hbm2java will work in the future.

Is there a way to instruct hbm2java to generate code using the non-primitive types?

Thanks Anders


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, map them with their object names. e.g. java.lang.Long instead of long

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 2:58 pm 
Newbie

Joined: Mon May 29, 2006 1:12 pm
Posts: 3
Thanks!

Will hibernate intepret java.lang.* correctly if I want to use hbm2ddl to generate the schema?

Wouldn't it be an idea to have an option on hbm2java to select this behavior for backwards compatibility?

Anders


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 3:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Code:
Will hibernate intepret java.lang.* correctly if I want to use hbm2ddl to generate the schema?


yes, they are equal in context of hibernate.

Code:
Wouldn't it be an idea to have an option on hbm2java to select this behavior for backwards compatibility?


It is opensource so feel free to contribute it.

I did not find it important enough when I did the change (more than a year ago) and we already had the rule back then + noone really ever complained/contributed about it when they found out how to fix it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 3:16 pm 
Newbie

Joined: Mon May 29, 2006 1:12 pm
Posts: 3
Fair enough! Thanks :)


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.