1

我打算使用带有 AciveJDBC 的 play web 框架来实现持久性。活动 JDBC 的问题在于它需要检测。我的问题是,

我是否需要重新启动服务器才能查看对需要检测的类所做的更改?

4

2 回答 2

3

joshua: this has never been attempted, but the answer would be no, you would have to restart the server to have changes in models to have an effect. However, if you practice true TDD and write tests that test models completely, you will not have to restart.

To Pere Villega: your answer is on the mark, and Hibernate truly is a popular framework, but it "being a great tool" is a matter of opinion and IMHO it is not, hence I developed ActiveJDBC.

A small fact: original version of ActiveJDBC back in 2009 did instrumentation on the fly in memory after an app start, which was great, but this has proven unreliable because of some containers' class loader behavior.

Additionally, I developed a Java web framework similar to Ruby on Rails: http://code.google.com/p/activeweb/, which has integration with ActiveJDBC. Currently it will recompile/reload controllers, but will not recompile/instrument models. However, I have plans to introduce this capability into the framework in the future.

cheers,

Igor

于 2011-04-22T21:20:01.970 回答
1

作为免责声明,我从未尝试过你所说的。但是根据我对 Play 工作原理的了解,这将取决于 ActiveJDBC 与 Play 的集成。

据我所知,没有用于该集成的现有模块。这意味着您将需要创建一些东西来将您的模型(基于 ActiveJDBC)插入到 Play 模型中。例如,类似于Siena插件的功能。

完成后,无需额外更改 Play 只会使用 Eclipse 编译器重新编译 Java 类,但不会生成任何工具。为了使检测发生,您可能需要调整重新编译过程,以便它也生成检测。

所以,简短的回答,默认情况下仪器不起作用。

一个相关的问题:你真的需要 ActiveJDBC 吗?JPA/Hibernate(Play 中的默认设置)不会提供什么?我理解“Active Record”行为的吸引力,但即使在 Ruby 社区中,也有人抱怨它的“魔力”。你确定JPA不够好?在使用 Play 时使用它可以节省您的时间和麻烦,并且 Hibernate 是一个庞大的团队和丰富的 ORM 开发经验,这使其成为一个很棒的工具......

于 2011-03-09T09:38:10.907 回答