-->
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 generate only wrapper type instead of primitive typ
PostPosted: Thu Oct 21, 2004 12:29 pm 
Newbie

Joined: Thu Oct 21, 2004 11:24 am
Posts: 3
Hi,

I use hbm2java to generate mapping objects from the mapping file.
I'd like to generate wrapper type instead of primitive type by default.
I can't manage to do this.

I run hbm2java from the ant class.
Here's my mapping file:

<class name="com.airfrance.comor.enterpriselayer.businessobject.Escale"
proxy="com.airfrance.comor.enterpriselayer.businessobject.Escale" table="TESTENV_ESCALE" mutable="true">

<id name="codeIata" type="string" column="codeIata" length="64" unsaved-value="null">
<generator class="uuid.hex"/>
</id>

<version column="version_number" name="version" />

<property name="nom" length="25" type="string" />

<property name="typeEsc" type="char" />
</class>

</hibernate-mapping>

Here's the result:

/** @author Hibernate CodeGenerator */
public class Escale implements Serializable {

/** identifier field */
private String codeIata;

/** nullable persistent field */
private String nom;

/** nullable persistent field */
private char typeEsc;

/** nullable persistent field */
private int version;

etc...

I would like to have:
/** @author Hibernate CodeGenerator */
public class Escale implements Serializable {

/** identifier field */
private String codeIata;

/** nullable persistent field */
private String nom;

/** nullable persistent field */
private Character typeEsc;

/** nullable persistent field */
private Integer version;

etc...

Is there a way to do it?

I didn't find anything on the forum, web that map correctly this problem.

Thanks by advance.

Eric

[b]Hibernate version: 2.1.6[/b]
[b]Hibernate-extensions: 2.1.2[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 2:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
have you tried using java.lang.Character as type instead ? ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 2:31 pm 
Newbie

Joined: Thu Oct 21, 2004 11:24 am
Posts: 3
I thought it was preferable to use hibernate type instead of java type.
Anyway thanks a lot.
I will generalyze this to the other attributes in my mapping files.

So I can admit that hbm2java try to transform by default hibernate type to primitive type. Is there a way to overule it?

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 2:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Yes by changing the map in BasicRenderer.java.

Patches for controlling it via e.g. properties are welcome.

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