-->
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.  [ 7 posts ] 
Author Message
 Post subject: Codegenerator
PostPosted: Tue Nov 04, 2003 9:18 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
How do I make the codegenerator create Integer instead of int.

When I put 'Integer' in the mapping file, it gives me a lot of warnings.

"WARNING: Could not find UserType: Integer. Using the type 'Integer' directly ins
tead. (java.lang.ClassNotFoundException: Integer)"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 9:22 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I this workaround valid?

"<element column="numberarray" type="java.lang.Integer" not-null="false" unique="false" /> "


instead of type="integer"

Am I in trouble doing the former?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 12:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
If you mean you want java.lang.Integer then you should write java.lang.Integer, ok ? ;)

Integer could just as well be a class in the default package - or a UserType....

yeah - I now noone in their right mind would do this, but trust me - I've seen weird people do this, and so hbm2java is only assuming very little to handle weird cases ;) ....and thus you need to use offical shortcuts (such as string, integer etc. or be explict about the type.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 3:57 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
OK - but when I specify 'integer' in the mapping file, the codegenerator creates Java sources with 'int' rather 'Integer'. I need the latter to be able to nulls...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Yes - so write java.lang.Integer ;)


integer can mean either int or java.lang.Integer.

hbm2java chooses the primitive version.

If you want this to be configurable then please post a JIRA - but is the possibility to write java.lang.Integer not enough ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 5:35 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Enough? Sure, as long as Hibernate SchemaExport, etc understands what I'm doing.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 5:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I would be surprised if it didn't ;)

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