在 Google App Engine 中重构包含 JDO @PersistenceCapable 类的包
我在包中有一组具有 JDO 持久性的类需要重构。
我知道如果您更改类名,那么您需要更新“BigTables”对象。但是,如果我更改java对象所属的包,这是否意味着“BigTables”中的数据对象需要以某种方式更新?
即 com.example.test.Person -> com.example.blah.Person
I have a set of JDO persistence capable classes in packages that need to be refactored.
I know if you change the class name then you need to update the "BigTables" objects. However, if I change the package the java objects belong to, will this mean the data objects in "BigTables" need to be somehow updated?
ie com.example.test.Person -> com.example.blah.Person
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
官方文档中的对象字段和实体属性。以下是重构规则的结果:
如果您需要进行上述简单修改无法实现的重构,您可能需要使用 App Engine MapReduce 库。
A little of this is documented in the official docs under Object Fields and Entity Properties. Here's the upshot in terms of refactoring rules:
If you need to do refactoring that can't be achieved with simple modifications as described above, you probably want to use the App Engine mapreduce library.
我假设情况是这样的:
我有一个类“com.peter.Foo”,我一直使用JDO坚持使用,并且我想将其更改为“com.nick.Foo”,将我所有现有的Foo实体需要更新吗?换句话说,JDO 在将 java 类映射到数据存储 Kind 时是否使用包名称?
AFAIK,appengine 中的 JDO 工具仅使用类名。之所以这么说,是因为当我查看管理控制台时,数据查看器和数据存储统计信息仅通过类名称引用我的实体。因此,如果您保持类名相同并且仅更改包名称,那么您的实体应该没问题。
I am assuming the situation is like this:
I have a class "com.peter.Foo" that I've been persisting using JDO, and I want to change it to "com.nick.Foo", will all my existing Foo entities need to be updated? In other words, does JDO use the package names when mapping a java class to a datastore Kind?
AFAIK, the JDO tools in appengine only use the class name. Is say this because when I look in the Admin console, both the dataviewer and datastore stats refer to my entities only by the class name. Therefore, if you keep your class names the same and only change the package names, your entities should be fine.