在 Play 1.1 上使用 Objectify 1.1rc 和 CRUD 时出现 M:1 关系问题

发布于 2024-10-06 11:36:57 字数 1408 浏览 8 评论 0原文

我遇到了一个非常奇怪的问题,也许你们中的一个人可以解释一下 在它上面。我将不胜感激:)

我正在使用 Objectify 1.1rc 模块开发一个应用程序用于 Play!框架 1.1。我有 2 个相关对象,其相关部分是:

public class User extends ObjectifyModel<User> {
  [...]
    public List<Key<Theatre>> theatres;
  [...]    
}

public class Theatre extends ObjectifyModel<Theatre> {
  [...]
}

一些背景:

  • 我正在使用 Google 代码存储库中的 Objectify 1.1rc(Play 存储库中的模块似乎在 Play! 1.1 中失败) 示例应用程序工作正常
  • 我基于现有的对象对象在 Play Framework (Showcase) 的 Objectify-1.1rc 模块提供的示例应用程序上正常工作。
  • 我通过将我的应用程序和示例应用程序 (Showcase) 指向同一个 CRUD 模块来进行调试和测试。
  • 我可以使用 Java 代码链接它们,没有任何问题。

目前我有两个无法解决的问题,它们是:

M:1 关系未保存

我对 User 类中的“剧院”关系有问题。当编辑一个 通过 CRUD 的 User 类型的对象,我可以看到将 Theater 实例与 User 关联的多选控件,当我单击其中一些(一个或多个)并保存对象时,该关系不会保存,因此无法通过 CRUD 接口链接对象。

怎样才能让它发挥作用呢?

CRUD 代码不被一个应用程序访问,但被另一个应用程序访问

来自 Objectify 模块 (Showcase) 的示例应用程序允许我使用 CRUD 保存 M:1 关系。正如我之前提到的,我的应用程序和展示都指向相同的 CRUD 模块,因此它们应该使用完全相同的代码。通过日志输出进行调试,我注意到我的应用程序使用 CRUD,但示例应用程序使用了特定点之前的所有代码。

CRUD 模块遍历到“tag/form.html”,找到“relation”类型的字段(在我的代码和示例应用程序中),但是当调用标签“#{crud.relationField}”时,会发生一些奇怪的事情:我的应用程序进入 CRUD 模块中定义的标签。示例应用程序不访问该代码,不会触发添加到该标记的日志(在文件的任何点)。

我在示例应用程序中搜索了该标签的任何替换项,但找不到。你可以猜到,这让他们发疯,让我开始相信绿色妖精住在我的桌面上(没有给我金子,该死的他们!)

有人知道为什么会发生这种情况吗?我能否找到示例应用程序正在执行的代码?找到它很可能会解决问题#1

非常感谢!

I'm having a really odd issue and maybe one of you can shed some light
on it. I would appreciate it :)

I'm developing an application using Objectify 1.1rc module for Play! Framework 1.1. I have 2 related objects whose relevant parts are:

public class User extends ObjectifyModel<User> {
  [...]
    public List<Key<Theatre>> theatres;
  [...]    
}

public class Theatre extends ObjectifyModel<Theatre> {
  [...]
}

Some background:

  • I'm using Objectify 1.1rc from the Google code repository (the module in Play repository seems to fail with Play! 1.1) The sample application works fine
  • I based the objects in existing objects working properly on the sample application provided with the Objectify-1.1rc module for Play Framework (Showcase).
  • I did debugging and testing by pointing my application and the sample application (Showcase) to the same CRUD module.
  • I can link them using Java code without any problem.

Presently I have 2 issues that I cannot solve, which are:

M:1 relation not being saved

I have an issue with the 'theatres' relation from the User class. When editing an
object of type User via CRUD, I can see the multi-select control to relate Theatre instances to the User, When I click on some (one or more) of them and save the object, the relation is not saved, making it impossible to link the objects via the CRUD interface.

How can make it work?

CRUD code not being accessed by one application but accessed by the other

The sample application from Objectify module (Showcase) allows me to save M:1 relations using CRUD. As I mentioned before, both my application and showcase point to the same CRUD module, so they should use exactly the same code. What I noticed, by debugging via Log outputs, is that my application uses CRUD, but the sample application uses all the code up to a certain point.

The CRUD module traverses to 'tag/form.html', finds a field of type 'relation' (in both my code and the sample application) but when calling the tag '#{crud.relationField}' something odd happens: my application goes into the tag defined in the CRUD module. The sample application doesn't access that code, no logs added to that tag are triggered (at any point of the file).

I've searched for any replacement of the tag in the sample application, but I'm unable to find one. As you can guess, it's driving em crazy and making me start believing in green leprechauns living in my desktop (without giving me the gold, damn them!)

Anyone knows why does this happen? And were can I find the code being executed by the sample application? Finding it would most likely solve the issue #1

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水染的天色ゝ 2024-10-13 11:36:57

好的,找到#1 的问题。我有一个名为“getTheatres()”的方法(应该有另一个名称,是一个错误),这破坏了 CRUD。重命名该方法解决了问题 #1。

我仍然没有找到为什么会发生#2,但我相信我会作为我们世界中常见的“在我的计算机中工作”问题之一离开......

Ok, found the issue to #1. I had a method called "getTheatres()" (should have had another name, was an error) and that was breaking the CRUD. Renaming the method solve issue #1.

I still didn't find why #2 was happening, but I believe I'll leave as one of those "worked in my computer" issues so common in our world...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文