-->
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.  [ 5 posts ] 
Author Message
 Post subject: Does Hibernate work with Database Views?
PostPosted: Thu Dec 09, 2004 7:45 am 
Newbie

Joined: Thu Dec 09, 2004 7:41 am
Posts: 4
Hibernate version: ANY

Name and version of the database you are using: Postgres


Hi,

Is anyone aware if Hibernate works with DB views and how? If you can point me to an example then it would be great.

Thanks.
+Deepak.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 7:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just map to it like a normal table.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 8:03 am 
Newbie

Joined: Thu Dec 09, 2004 7:41 am
Posts: 4
Thanks Michael for the prompt response. However, I guess I have stated my question incorrectly. Let me try to put the question in place.

I have to execute a monster query which will have links between multiple tables (abt 5-6 tables). Executing it using HQL may not be a good idea. Hence it was suggested that I should create a view to help us running queries on that model. My question is how can Hibernate help in this type of situation?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 8:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I dont get what you are talking about. Just create your view and map an object to it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 8:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
I have to execute a monster query which will have links between multiple tables (abt 5-6 tables). Executing it using HQL may not be a good idea. Hence it was suggested that I should create a view to help us running queries on that model. My question is how can Hibernate help in this type of situation?



1- be sure you cannot do it in hql, give an example to see why hql cannot solve your query.
If you aren't able to execute this query in hql, maybe that mean that this query isn't oo which isn't bad. But in this case why don't you use a stored procedure and call it in a DAOJBDC method?

2- if you simplify this query using a view and really want to use this view with mapped objets, just map an object to it, what is difficult?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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