-->
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: attach a non-hibernate instantiated mapped class to session
PostPosted: Mon Jan 10, 2005 8:43 pm 
Newbie

Joined: Fri Nov 21, 2003 7:34 pm
Posts: 2
Hibernate version:2.1.7 (with MySQL 4.0.20)

I have a query which needs to return a hibernate entity and a scalar value. I'm using the count() and if() functions from mysql, so I believe I cannot use HQL. Additionally, the entity + scalara combination eliminates using createSQLQuery().

I can, however, retrieve all the properties for the entity instance in addition to the scalar value via jdbc.

The question is, can I use those property values to create an instance of the entity as though the instance was created by hibernate itself?

The goal is for the entity relationships (mapped with lazy initialization) to still be functional, even though I have manually instantiated the entity and populated the properties.

The other option seems to be to use jdbc to get the entity id and the scalara value, and then use HQL with the entity id to load the actual entity instance. Would be nice if I could skip the second query.

thanks,

Miguel


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.