-->
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.  [ 3 posts ] 
Author Message
 Post subject: Can Hibernate "persist" objects not mapped to a ta
PostPosted: Tue May 18, 2004 11:06 am 
Newbie

Joined: Tue May 18, 2004 10:47 am
Posts: 5
Hello and thanx for any help you can offer.
As part of an evaluation of Hibernate as a possible component of an application that is being refactored, I have downloaded version 2.1.3 and done some very successful initial testing.This has led me to the details (where the devil is).
My question is:
Can I map a class that is NOT directly related to a database table?
The current application does a query that yeilds a result set from a multi table join. That result set is then "processed" to produce instances of a class (let's call it ClassX) that is not directly related to any single table.
ClassX is also NOT related to ant set of tables by virtue of relationships defined in the database DDL.

It is my assumption that I CANNOT map ClassX and that I will only be
able to map the classes that are related to tables that are used in the above mentioned join. The processing that produces the instances of ClassX will have to be done without Hibernate's help.

Is my assumption correct?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 11:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can not map SQL queries to unmapped result classes. You can however use the "select new Something(xxx,yyy,zzz)" in HQL to return unmapped classes from HQL queries.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 11:30 am 
Newbie

Joined: Fri Oct 28, 2005 10:32 pm
Posts: 13
"select new Something(xxx,yyy,zzz)"

could you explain this kind of hql in detail?
I also encountered the multi-table mapping problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.