[
http://jira.jboss.com/jira/browse/JBSEAM-1596?page=comments#action_12380066 ]
Diego Ballve commented on JBSEAM-1596:
--------------------------------------
Let aside full blow lock'n'check, an optimistic check would already be a good
helper for most of us. The database constraint is still there to catch the cases when that
is not enough, right?
I was thinking on how do do it with hibernate validator -like approach but you lack the
entity there, so even if you could check if the value is defined in database (entityClass+
property passed as init params to the restriction annotation) you can't perform a
basic check: is it defined for the same object.
One could define an extended hibernate Validator interface that would also take the entity
on isValid().. if only ClassValidator would expose its memberValidators, you could detect
those from Seam ValidatingResolver and call the new isValid().
On the other hand, the entityClass already gives you what you need to know to build a
checking query: (i.e, @Id, @Column(unique=true), etc).It would be a lot of digging for
annotations, but still possible to find out what you need.
I have not found a good approach to go with the current interfaces yet, but maybe
collecting some possible approaches might shine some light in the discussion.
Unique Constraint Validator
---------------------------
Key: JBSEAM-1596
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1596
Project: JBoss Seam
Issue Type: Feature Request
Components: JSF
Affects Versions: 2.0.0.BETA1
Reporter: Pete Muir
Priority: Minor
We could have a generic unique constrain validator as part of the model validation.
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059691#...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira