Re: BeanEditForm onValidate()

"Christopher Dodunski" <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <[email protected]>
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.