简体   繁体   English

Play Framework With Google Appengine Model更新

[英]Play Framework With Google appengine Model update

I have a Play application which is deployed on Google Appengine. 我有一个部署在Google Appengine上的Play应用程序。 I use Play 1.2.4 with modules: crudsiena 2.0.1 gae-1.6 secure siena 2.0.5 我将Play 1.2.4与模块一起使用:crudsiena 2.0.1 gae-1.6 secure siena 2.0.5

My problem is the followings: I have deployed the application with several number of Models and the app is running just fine. 我的问题如下:我已经用几种型号部署了该应用程序,并且该应用程序运行良好。 After a while I decided to improve the application which required the introduction of new variables in the Model classes. 一段时间后,我决定改进应用程序,这需要在Model类中引入新的变量。 If I do this, my localhost is working just fine, however when I upload the new version to the GAE I receive errors when I try to access the model objects created with the old version as it cannot associate the new variable: 如果这样做,我的本地主机就可以正常工作,但是当我将新版本上传到GAE时,尝试访问使用旧版本创建的模型对象时会收到错误消息,因为它无法关联新变量:

play.exceptions.JavaExecutionException: siena.SienaException: java.lang.IllegalArgumentException: Can not set boolean field models.Dataset.reportEnabled to java.lang.Integer
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:229)
at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:540)
at play.Invoker$Invocation.run(Invoker.java:265)
at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:531)
at play.Invoker.invokeInThread(Invoker.java:67)
at play.server.ServletWrapper.service(ServletWrapper.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

In this case the boolean reportEnabled variable was newly introduced to the Dataset class. 在这种情况下,boolean reportEnabled变量是新引入到Dataset类的。 My question is how to make the application work by keeping the old objects as well (probably just provide a default value to the new variables). 我的问题是如何通过保留旧对象来使应用程序正常工作(可能只是为新变量提供默认值)。

Your help is very much appreciated. 非常感激你的帮助。

The problem is solved by changing boolean to Boolean. 通过将布尔值更改为布尔值可以解决该问题。 It did not change the structure of the database in the previous entries, but at least I get no error any more. 它并没有改变以前条目中数据库的结构,但是至少我再也没有收到错误了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM