-->
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: Would like to transparently persist owner (security) info
PostPosted: Wed Mar 29, 2006 3:54 pm 
Newbie

Joined: Wed Mar 29, 2006 3:38 pm
Posts: 1
In my project, I have an entity - let's say PurchaseOrder. In order to support the persistence of purchase orders, I have my nhib mappings and db tables created - and everything works fine.

Now, in order to support security requirements, i need to have all purchase orders associated with a system user, which is maintained in a Users database tables and associated via a FK on the PurchaseOrders table. I don't want to create a mapping element for user on PurchaseOrder becuase User doesn't really take part in defining PurchaseOrder. However, I need the owning User specified in the database.

Is there a way to do this kind of persistence in NHibernate?

My current solution is to create an interceptor and associate it with a session (and pass the session to the interceptor) - then on the PostFlush call, get the connection from the session and execute a SQL update statement passing the ID of the user object that exists in context.

Any thoughts on the subject are greatly appreciated!

TIA,

_howard


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.