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: Mapping to SQL Server views
PostPosted: Wed Jun 21, 2006 6:05 am 
Beginner
Beginner

Joined: Wed Apr 26, 2006 4:12 am
Posts: 29
Has anyone successfully created a mapping to a database view in SQL Server?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 10:49 am 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
Yes, I have. The trick here is that if you *really* want updatable views with complex join scenarios, you need to look into also using a feature called INSTEAD OF triggers. This is a SQL Server feature only that allows you to define the UPDATE, DELETE and INSERT behavior for a view.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 12:47 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
another point is, that you have to define a primary key column even if views don't have a primary key. You can take any column of the view which contains unique values. For views which don't have columns with unique values we define a dummy column like "newid() as ID".


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.