O HibernateFilter já fecha a sessão a cada requisição ao banco...
Meu AppManager:
Code:
this.action( "MyEspace" , MyEspaceAction.class , "formUpdatePerson" )
.filter( new AuthenticationFilter() )
.on( AuthenticationFilter.LOGIN , fwd( "MyEspace.login.jsp" ) )
.on( MyEspaceAction.SUCCESS , fwd( "MyEspace.formUpdatePerson.jsp" ) )
.filter( new IoCFilter( this.personDAO , "personDAO" , IoCFilter.REQUEST ) )
.filter( new HibernateFilter() )
.filter( new DependencyFilter( HibernateFilter.KEY , "personDAO" , "session" ) );
Meu Action:
Code:
public String formUpdatePerson() throws Exception {
Person personSession = ( Person ) BaseLoginAction.getUserSession( session );
this.personManager = new PersonManager( ( PersonDAO ) input.getValue( "personDAO" ) );
Person person = this.personManager.loadById( personSession.getId() );
output.setValue( "id" , person.getId() );
output.setValue( "name" , person.getName() );
output.setValue( "email" , person.getEmail() );
output.setValue( "birthDate" , person.getBirthDate() );
output.setValue( "church" , person.getChurch() );
output.setValue( "position" , person.getPosition() );
output.setValue( "password" , person.getPassword() );
return SUCCESS;
}
PersonManager:
Code:
public Person loadById( Long id ){
try {
return this.personDAO.loadById( id );
}catch( Exception e ){
return null;
}
}
PersonHibernateDAO:
Code:
public void update( Person person ) throws Exception {
Transaction transaction = this.session.beginTransaction();
try{
this.session.update( person );
transaction.commit();
}catch( Exception e ){
transaction.rollback();
}
}
public Person loadById( Long id ) throws Exception {
return ( Person ) this.session.get( Person.class , id );
}
Mas vou tentando...