-->
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: Interceptor and EventListener behavior
PostPosted: Thu May 18, 2006 8:16 pm 
Newbie

Joined: Fri Apr 29, 2005 2:34 pm
Posts: 4
When I set hibernate to use Interceptor or EventListener in my application, some exceptions start to be thrown in flush time.

Ex.
The folow code:
Code:
System.out.println("before");

//load the object         
Vinculo v = sistema.getRecursosHumanos().consultarVinculo(200201129);

//change atributte
v.setAtivo(true);

//flush session
gerenciadorConexoes.getSessaoCorrente().flush();

System.out.println("after");


With the EventListener:

Code:
public class HibernateOnFlushEventListener implements FlushEntityEventListener {

   public void onFlushEntity(FlushEntityEvent event)
      throws HibernateException {
      System.out.println("Tipo dirty: "+event.getEntity().getClass().getSimpleName());
   }
}


the output is:

Code:
before
Tipo dirty: InstituicaoEnsino
Tipo dirty: TipoInstituicaoEnsino
Tipo dirty: VinculoImpl
siga.fachada.SistemaException: Don't dereference a collection with cascade="all-delete-orphan": siga.recursosHumanos.vinculo.Vinculo.vinculoPerfilCollection
   at siga.bd.Controlador.cancelarTransacao(Controlador.java:146)
   at siga.bd.Controlador.confirmarTransacao(Controlador.java:125)
   at siga.fachada.ControladorRecursosHumanos.consultarVinculo(ControladorRecursosHumanos.java:4251)
   at siga.Teste.main(Teste.java:62)


whithout the EventListener:

Code:
before
after


What could I'm doing wrong?


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.