Hi everybody,
I'm developing a Roo web application. However this error looks to me more related to MVC rather than Roo itself.
I have a constraint validator that checks for "unique index". I couldn't add it to the schema generation because the properties are split in two tables (father and son). For example the entity Tag holds the info about the value of the tag, UserTag adds info about the owner. The logical unicity constraint is on the combination of value and owner. This is what I use the validator for.
To do so, in the validator a PersistenceContext is injected (actually, in one of its autowired properties).
When validating, I get the following error:
(the UUID is generated in the @PrePersist method of the entity)Code:org.hibernate.exception.ConstraintViolationException: Duplicate entry '0263110c-dfdd-42cb-a390-91b16ea2b914' for key 'PRIMARY'; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: Duplicate entry '0263110c-dfdd-42cb-a390-91b16ea2b914' for key 'PRIMARY'
If I remove the constraint from the class, everything works fine but obviously this could lead to data duplication.
Any hint?
Stefano
PS: let me know if you need to see some excerpt of the code / configuration


Reply With Quote
