Table des matières
Playframework bugs
Play 1.2: call merge() save entity
2011-04-15
public class Essais02 extends Controller { public static void index() { Logger.debug("Person count %d", Person.count()); Person p = new Person(); p.name = "blabla"; p.merge(); ...
Voir:
- Essais02
Pas de gestion des violations d'intégrité
Les erreurs d'intégrité ne sont pas gérées par Play!, du coup il va falloir se les palucher à la mano !!
1.A l'effacement d'une valeur de catégorie référencée par une autre table:
03:06:31,776 DEBUG ~ delete from CategoryValue where category_id=? 03:06:31,777 WARN ~ SQL Error: 23003, SQLState: 23003 03:06:31,777 ERROR ~ Referential integrity constraint violation: "FK4D440479B6C2B74C: PUBLIC.CATEGORYCOMBINAISONITEM FOREIGN KEY(CATEGORYVALUE_ID) REFERENCES PUBLIC.CATEGORYVALUE(ID)"; SQL statement: play.exceptions.JavaExecutionException: org.hibernate.exception.ConstraintViolationException: could not execute update query Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "FK4D440479B6C2B74C: PUBLIC.CATEGORYCOMBINAISONITEM FOREIGN KEY(CATEGORYVALUE_ID) REFERENCES PUBLIC.CATEGORYVALUE(ID)"; SQL statement: delete from CategoryValue where category_id=? [23003-149]
2.A l'insertion d'une valeur ayant le même code qu'une valeur existante:
03:05:43,987 DEBUG ~ /* insert models.categories.CategoryValue */ insert into CategoryValue (category_id, code, id) values (?, ?, ?) 03:05:43,999 WARN ~ SQL Error: 23001, SQLState: 23001 03:05:43,999 ERROR ~ Unique index or primary key violation: "CONSTRAINT_INDEX_C ON PUBLIC.CATEGORYVALUE(CODE, CATEGORY_ID)"; SQL statement: /* insert models.categories.CategoryValue */ insert into CategoryValue (category_id, code, id) values (?, ?, ?) [23001-149] play.exceptions.JavaExecutionException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "CONSTRAINT_INDEX_C ON PUBLIC.CATEGORYVALUE(CODE, CATEGORY_ID)"; SQL statement: /* insert models.categories.CategoryValue */ insert into CategoryValue (category_id, code, id) values (?, ?, ?) [23001-149]
HowTo make "user friendly" message when catching ConstraintViolationException ?
HowTo : UniqueConstraint and ManyToOne
A JPA error occurred (Unable to build EntityManagerFactory): @Column(s) not allowed on a @ManyToOne property: CategoryValue.category Ok, I understand that I can't naming the column for the ManyToOne relation, seems to be a JPA's rule, but how to implement the case ? Have you got a idea on how to get around ?
HowTo : UniqueConstraint and ManyToOne
Such a bad day … The lesson is : NEVER USE “hibernate.globally_quoted_identifiers=true”
feature request: 'anchor' option for tag "form"
2011-04-13 ticket #729
Validation entités sans id
2011-04-13 ticket #726
Minimum size is 2 ( cv_0.code: Minimum size is 2 )
Validation failed ( cv_0: Validation failed )
Minimum size is 2 ( cv_1.code: Minimum size is 2 )
Validation failed ( cv_1: Validation failed )
Minimum size is 2 ( cv_2.code: Minimum size is 2 )
Validation failed ( cv_2: Validation failed )
Minimum size is 2 ( cv_2.cv_3.code: Minimum size is 2 )
Validation failed ( cv_3: Validation failed )
Minimum size is 2 ( cv_2.cv_3.cv_4.code: Minimum size is 2 )
Validation failed ( cv_4: Validation failed )
play.data.validation ; ValidCheck.isSatisfied(...) { String superKey = ValidationPlugin.keys.get().get(validatedObject);
The solution in my case was to a negative fake id to empty entities before calling the Validation.
Detached object and GenericModel.merge() problem
Invalid SQL syntax for count() query with Entity which have Identity composite key
2011-04-09 ticket #717
"Sample validation" has error (play.test.ApplicationTest does not exists)
2011-02-27 ticket #615