开发者

type mistmach for notmodified enum while loading Fixtures

开发者 https://www.devze.com 2023-04-06 16:51 出处:网络
I\'m using @ApplicationStart job to fill dev db with some values, but i\'m encountering strange behavoiur after i clear it with:

I'm using @ApplicationStart job to fill dev db with some values, but i'm encountering strange behavoiur after i clear it with:

Fixtures.deleteDatabase()

Some of my models have a field which is enumeration, each time when it tries to read object from yaml it stops on one of these models with enumerations and fires exception some thing like this:

play.exceptions.JavaExecutionException: Parameter value [OPEN] was not matching type  [enumerations.OrderStatus]
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:229)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: Parameter value [OPEN] was not matching  type [enumerations.OrderStatus]
    at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:360)
    at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:435)
    at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:72)
    at play.db.jpa.JPQL.bindParameters(JPQL.java:169)
    at play.db.jpa.JPQL.find(JPQL.java:46)
    at models.Order.find(Order.java)
    at controllers.Application._prepare(Application.java:52)
...

I'm not modifing enum. it is "all the way" the same. What im doing wrong?

ps.Enum is not mapped to db, i think that it could be root of problem but than could you advise how to do it right way from architectual point of view? i'm almost newbie in hibernate/jpa

Upd1

it happens ocassionaly on onloading, here is one of models in yaml where it crashes (as you see nothing odd here):

models.users.GenUser(usr3):
    name: V
    phoneNumber: "1234567890"
    email: v@mail.com.not
    login: v
    password: "123"
    userStatus: ACTIVE

here 'userStatus' is an enum with possiblevalues ACTIVE, BANNED, and others.

i found only one solution - trop table(s) for model and let hibernate to recreate it(them). but sometimes due to relations it is easier to drop whole db and it i开发者_C百科s very annyoing ;(

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号