-->
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.  [ 8 posts ] 
Author Message
 Post subject: Does NHibernet supports View
PostPosted: Tue Feb 06, 2007 6:45 am 
Newbie

Joined: Tue Feb 06, 2007 6:40 am
Posts: 4
Can anybody tell me does NHibernet supports views

_________________
Amol Jagtap


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 7:15 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
yes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:59 am 
Beginner
Beginner

Joined: Wed Jul 19, 2006 8:24 am
Posts: 35
yes, but be careful if you're using 2nd level cache on the objects


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 11:59 am 
Newbie

Joined: Mon Jan 15, 2007 10:09 am
Posts: 12
you can use it because i did it. You just have to create your view and use it as a table. However, there is a problem you shouldn't forget : a view is readonly... So you can just display results.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 1:29 pm 
Newbie

Joined: Tue Feb 06, 2007 6:40 am
Posts: 4
Samuel wrote:
you can use it because i did it. You just have to create your view and use it as a table. However, there is a problem you shouldn't forget : a view is readonly... So you can just display results.



Thanks , for quick response.

_________________
Amol Jagtap


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 2:02 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
also you should use the mutable="false" attribute on the class tag. This avoids that NHibernate takes care of changes in the object.

Regards
Klaus


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 5:16 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
I view doesn't necessarily have to be read only - this limitation only applies if the view spans multiple tables and an update statement would update fields from more than one table. So, if only properties mapped to a single table are updatable you can update the data in a view.

Note that this is based on SQL Server - YMMV.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 9:44 am 
Beginner
Beginner

Joined: Wed Jul 19, 2006 8:24 am
Posts: 35
You must be able to define a unique key on the view too. If the key ends up being a surrogate make sure the surrogate will stay they same across all queries that access the view, ie. don't use a rownumber() function as a surrogate.


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