-->
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.  [ 1 post ] 
Author Message
 Post subject: Custom SQL for Inserting, Updating, Deleting and Views
PostPosted: Fri Oct 27, 2006 6:27 am 
Newbie

Joined: Tue Oct 24, 2006 2:51 pm
Posts: 19
NHibernate 1.2beta1

Ths version of NH supports one cool feature that is Custom SQL for inserting, updating or deleting within a mapped class
One thing i was asking myself is if NHibernate even supports mapping the class to a VIEW and not a TABLE, this can be useful in a scenario where we create a
"Surrogate Database Entity"
, for example, given the usual example of User class, we could have a table

UserName Permissions
admin 0x0101b (this is a bitmask)

and another table

PermissionDescription

id description
0x0001 insert
0x0010 update
0x0100 delete
0x1000 someotherstuff

we could create a view in a database (it is pretty simple in sql server using boolean operators) that given the ADMIN user, the result will be
something like

userName PermissionDescription
admin insert
admin delete

(note: we only have insert and delete here - notice the bitmask above)

Now comes the question! :-) Can NHibernate map this view? if this will be possibile, i will add a custom SQL SP call in insert, update and delete that can change the bit value on the bitmask field

And, if views are not supported, i figure i can solve the question using CUSTOM SQL Loading expression, but...what are the limitations ? NHibernate has a PLENTY of features and i cannot fiure what limitations my class may have associating or making part of a collection with other entity classes

Hope i explained well (maybe not...:-) )


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.