-->
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: Typesafe collection defined in mapping file
PostPosted: Wed Sep 20, 2006 12:57 pm 
Newbie

Joined: Sat Mar 18, 2006 1:13 am
Posts: 10
In the hbm.xml file that defines my entity, is there a way to create a type-safe collection?

For example, I've been using:
<set name="myObjs">
<key column="OBJ_ID" />
<one-to-many class="MyObj" />
</set>

When I run this through hbm2java, it generates
public Set getMyObjs()
public void setMyObjs(Set myObjs)

I'd prefer it to create a typesafe collection:
public Set<MyObj> getMyObjs()
public void setMyObjs(Set<MyObj> myObjs)

Is this supported? If so, how?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 20, 2006 1:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
run hbm2java with jdk5 set to true.

p.s. much better to ask tool related questions in the tool forum.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 21, 2006 2:32 pm 
Newbie

Joined: Sat Mar 18, 2006 1:13 am
Posts: 10
Had to research it a bit, but you put me on the right track.

<hbm2java> in ant supports "generics=true". Looks like earlier versions of hibernate called this "jdk5" or "jdk", but it looks like they finally settled on "generics".

Thanks much!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 21, 2006 2:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no, the other way around.

new version has jdk5 as the attribute to say if the exporters may generate jdk5 constructs (such as generics, foreach etc.)

ejb3 covers jpa and ejb3

you are not using a recent version if generics works for you ;)

/max

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