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: Intercepting the objects between application and database
PostPosted: Fri Aug 04, 2006 10:07 am 
Newbie

Joined: Fri Aug 04, 2006 9:31 am
Posts: 1
Location: Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
at java.util.HashMap$ValueIterator.next(HashMap.java:817)
at org.hibernate.util.LazyIterator.next(LazyIterator.java:55)
at br.com.murah.murahFramework.model.persistencia.hibernate.MurahBeanInterceptor.postFlush(MurahBeanInterceptor.java:52)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:347)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
at $Proxy0.flush(Unknown Source)
at br.com.murah.murahFramework.model.persistencia.hibernate.HibernateDAO.finalizarTransacao(HibernateDAO.java:1042)
at gerador.TesteCipher.main(TesteCipher.java:133)


Name and version of the database you are using: Oracle 10g XE

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hello,
I'm using an Interceptor implementation of the methods preFlush/postFlush to get the objects and to decode/enconde their attributes after/before to be saved on database.
But I'm getting the java.util.ConcurrentModificationException. There is any idea in how to fix this?
These methods are the best place to to this?
Thanks in advance for the help,
Eudenia


Code:
public class MurahBeanInterceptor extends EmptyInterceptor
{
   public void preFlush(Iterator entities) throws CallbackException
   {
      try
      {   if(entities==null)
            return;
         while(entities.hasNext()){
            MurahBean bean=(MurahBean) entities.next();
            if(bean!=null &&){
               CodeHelper.encode(bean);
            }
         }
      }
      catch (Exception e)
      {
         e.printStackTrace();
         throw new CallbackException("PreFlush problems... \n"+e.getMessage());
      }
   }
       public void postFlush(Iterator entities) throws CallbackException{
         try
         {
            if(entities==null)
               return;
            while( entities.hasNext()){
            MurahBean bean=(MurahBean) entities.next();
            if(bean!=null ){
                   CodeHelper.decode(bean);
            }
            }
         }
         catch (Exception e)
         {
            e.printStackTrace();
            throw new CallbackException("PostFlush problems... \n"+e.getMessage());
         }
    
      
   
}


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.