-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping a Collection of Elements using an SQL Query
PostPosted: Wed Oct 03, 2007 2:29 pm 
Newbie

Joined: Thu Aug 24, 2006 5:14 pm
Posts: 4
Hello fellow hibernaters,

I have a persistent entity with a property that is a collection of primitives (a Map<Long, Integer>), and I want this collection to be loaded automatically using a native SQL query. This is a read-only collection, so I only need it to be loaded along with the object. Is this possible?

It seems like <load-collection> is the closest thing to what I need, however I've only seen it used for collections of entities, not elements such as primitive types. And I've not seen it used for Maps at all, whether they contain entities or primitives.

Worst case I could use the Query API to manually populate the map in my getter method, but I don't want my object model be so closely tied to the persistence API...

Any help with this would be greatly appreciated.

Hibernate version:

Hibernate 3.2.5
Hibernate Annotations 3.3.0 GA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.