History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: APF-935
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Matt Raible
Reporter: Christophe Thiébaud
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

DB exception not well handled when updating existing user with using lazyLoadingFilter active

Created: 11/Oct/07 08:55 AM   Updated: 03/May/08 11:04 PM
Component/s: Service Layer
Affects Version/s: 2.0 Final
Fix Version/s: 2.1

Environment: Windows XP, tomcat 6, hibernate, MySQL 5.04


 Description  « Hide
after enabling lazyLoadingFilter, when *updating* an user (e.g. 'admin') with some value rejected by the DB (e.g. change 'admin' Username to already existing 'user' Username : the unique key on app_user.username fires an exception), the DB raw exception is displayed to the user instead of begin trapped.

When *creating* a new user, the exception is correctly handled.

seems that the entityManager.flush() is not raising the exception when updating e record + lazy loading enabled.

NB. the behaviour is exactly the same when using JPA instead of hibernate

how to reproduce
-> mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0 -DgroupId=a.group.id -DartifactId=test
-> cd test
-> change web/src/.../web.xml to enable lazyLoadingFilter as documented into web.xml
-> launch app under tomcat
-> edit user 'admin'
-> change Username to 'user'

 All   Comments   Change History   FishEye      Sort Order:
Matt Raible - 24/Nov/07 08:46 AM
I was able to reproduce it, but I don't know how to solve it. For some reason, a raw Hibernate exception (org.hibernate.exception.ConstraintViolationException) is being thrown and it's not wrapped by a Spring exception. Since this exception is not caught in UserManagerImpl and re-wrapped as a UserExistsException, the error does not display as expected. I don't want to put logic in UserManagerImpl that catches this exception because it's specific to Hibernate.

If you find a solution, I'd love to hear about it. In the meantime, I'm moving this issue to the next release.

Matt Raible - 03/May/08 11:04 PM
Moving to next release since I still don't have a good solution.