-->
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: Custom sql function on save / update
PostPosted: Tue Oct 16, 2007 10:33 pm 
Newbie

Joined: Wed Aug 08, 2007 10:11 pm
Posts: 3
hi,
i've extended database dialect class to register encryption sql function.
i want to use it for property in some entity automatically when we do
Code:
session.save(object);

or
Code:
session.update(object);


the property that saved or updated are using this function before saved and updated, does anyone have any idea how to do this ?

i don't want to use <sql-insert> or <sql-update> because it have some flaw for my needs.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 1:08 am 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
Yes it's possible using hibernate's Session Interceptors or event listeners.

You can register these listeners for persistent event such as Load, Update, Flush, etc.

You can read here for the details
http://www.hibernate.org/hib_docs/v3/re ... le/#events

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 1:25 am 
Newbie

Joined: Wed Aug 08, 2007 10:11 pm
Posts: 3
thanks for quick reply,
i've seen the interceptor on a link that u provided.
yes it can modify the value of the property before the event, but the modification that i need is trying to use hql function for that property before the event, AFAIK it don't have any reference to do this ?


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.