-->
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: Hibernate Uppercase interceptor - stalestateexception
PostPosted: Tue Mar 11, 2014 12:23 pm 
Newbie

Joined: Tue Mar 11, 2014 12:16 pm
Posts: 1
All,

I wrote a hibernate interceptor for converting all strings into upper case as shown below. It works well in general except for one case where it is throwing a stalestateexception. for now i created a condition to check for xxx class which is where i am having a problem as a work around. Wondering if you have seen this before and shed some light.

thanks,

Code:

        public boolean onSave(Object entity, Serializable id, Object[] state,
         String[] propertyNames, Type[] types) {

         convertProperties(entity, state, propertyNames, types);         

      return super.onSave(entity, id, state, propertyNames, types);

   }
   private void convertProperties(Object entity, Object[] currentState, String[] propertyNames, Type[] types) {
      if (!(entity instanceof XXX))
      {
         for (int i = 0; i < currentState.length; i++) {
            if (currentState[i] instanceof String && currentState[i] != null) {
               currentState[i] = ((String) currentState[i]).toUpperCase();
            }
         }         
      }
   }


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.