greenlaw110/play-morphia — Issue #67: @Unique does not work
Author: nikos
Created: 2012-02-20 15:57:10+00:00
State: open

Using: Play 1.2.4 together with Morphia Plugin 1.2.4 I get for a class containing
an @Unique annotation (play.data.validation.Unique):

An unexpected error occured caused by exception ClassCastException: models.ContentType cannot be cast to play.db.jpa.GenericModel

play.exceptions.UnexpectedException: Unexpected Error
at play.data.validation.Validation.applyCheck(Validation.java:463)
at play.data.validation.Validation.valid(Validation.java:442)
at play.data.validation.Validation.valid(Validation.java:447)
at controllers.CRUD.save(CRUD.java:106)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.ClassCastException: models.ContentType cannot be cast to play.db.jpa.GenericModel
at play.data.validation.UniqueCheck.isSatisfied(UniqueCheck.java:61)
at net.sf.oval.Validator._checkConstraint(Validator.java:575)
at net.sf.oval.Validator.checkConstraint(Validator.java:887)
at net.sf.oval.Validator._validateObjectInvariants(Validator.java:650)
at net.sf.oval.Validator.validateInvariants(Validator.java:1455)
at net.sf.oval.Validator.validate(Validator.java:1365)
at play.data.validation.ValidCheck.validateObject(ValidCheck.java:66)
at play.data.validation.ValidCheck.isSatisfied(ValidCheck.java:60)
at play.data.validation.Validation.applyCheck(Validation.java:453)
... 9 more