To summarise...
the exceptions:
org.hibernate.exception.ConstraintViolationException
could not execute statement
SQL
n/a
SQLState
23000
errorCode
1062
and:
java.sql.SQLIntegrityConstraintViolationException
Duplicate entry 'Abel' for key 'UK_h029unq4qgmbvesub83df4vok'
SQLState
23000
errorCode
1062
is thrown when the below line is reached in onValidate():
User userVerif =
crudServiceDAO.findUniqueWithNamedQuery(User.BY_USERNAME,
QueryParameters.with("userName", user.getUserName()).parameters());
yet this is only calling the below 'HQL select' NamedQuery:
@NamedQuery(name = User.BY_USERNAME, query = "Select u from User u
where u.userName = :userName"),
which raises the question:
Who or what is automatically attempting to illegally persist a user
with duplicate userName? BeanEditForm? Hibernate? Ghosts?
Quoting from http://tapestry.apache.org/beaneditform-guide.html:
Automatic Object Creation
If the object does not exist, it will be created as needed.
Does altering the userName field (a unique field) invoke this "automatic
object creation"? I don't imagine this is the case, else why would
BeanEditForm bother firing a 'validate' event?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]