-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with retrieving data from a view
PostPosted: Fri Sep 08, 2006 9:11 am 
Newbie

Joined: Fri Sep 08, 2006 9:04 am
Posts: 3
Hi,

For my current project i want to retrieve some data from a database view and show it to the user. I want to know whether i can do it with the help of hibernate.


the problem is in the view there is no column with a primary key or unique key, so i can not assign a <id> property in the hibernate mapping file.


If somebody can tell me how to map to a database view without the use of <id> property in the mapping file?


Thanx.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 2:05 pm 
Regular
Regular

Joined: Fri Aug 18, 2006 2:40 pm
Posts: 51
Location: Metz, France
Use composite-id as in
http://www.hibernate.org/hib_docs/v3/re ... ompositeid

But take care, especially when doing "join" with this composite-id, there are some known limitations.

However, best way when possible, is to add a column to the view using for instance concat( col1, col2), assuming col1 and col2 are enough to determine a unique row.

_________________
Denis
Don't forget to rate ... thanks.


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