-->
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: Current persistent state in SessionFactoryInterceptor?
PostPosted: Tue Sep 26, 2006 1:38 pm 
Newbie

Joined: Tue Sep 12, 2006 7:03 am
Posts: 7
Location: Berlin
Hi,

I'm using JBossAS 4.0.4 with Hibernate 3.0. I installed a SessionFactoryInterceptor and would like to compare the current persistent object state with a modified object's state.

The Interceptor interface provides a method findDirty with a previousState parameter reflecting the object state as it was when the current hibernate session started. The previousState array therefore does not reflect the current persistent state but a detached object's state.
Code:
public int[] findDirty(Object entity,
                       Serializable id,
                       Object[] currentState,
                       Object[] previousState,
                       String[] propertyNames,
                       Type[] types)


What would be the best way to obtain the field values as currently stored in the database? HQL queries do not seem to work as they always return the current object version from the object cache (because this is the most recent object version).

I figured one could use a native SQL query to circumvent Hibernate's object cache. Where I encountered my next problem: how do I get the database table and column names for a persitent class? The ClassMetadata seems to contain property names but not the mapped field names for use in native queries.

Thanks in advance for any advice

Fritz

_________________
His Darkness and His Brightness
exchanged greetings of extreme politeness


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.