简体   繁体   中英

GAE, change an class for a persistent object

I have a web application with some data in its datastore. I have just finished another version of it, in which i changed one of the persistent classes. Basically, there is a class called "Node" (which represents a node in a hierarchy tree), that used to have it's author as a

private CmsUser author;

and now it stores its author as private Key author .

When i deployed that second version to the server (as another version), it didnt work (which is predictable).

Is there any way to make it work? Or do i have to create another entity instead of the Node thing and write a piece of code that would change all my old nodes into new ones?

Thanks.

You will have to write some code that loads each Node in its old form, then saves it in the new form.

Since it looks like you are using java, you can do this with the low level API . If you were using Python, there is a trick you can do with Expando. See here

You might want to try the new Mapper API to handle looping through all your entities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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