GWT 和休眠
您认为对于需要非常丰富的 UI 的 Web 应用程序来说,仅使用 GWT 和 Hibernate 听起来像是一个“理智”的解决方案吗?
Do you think that using just GWT and Hibernate sound like a "sane" solution for a web application that needs a very rich UI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
GWT 和 Hibernate 并不是天然的搭配。有关为什么以及如何将它们一起使用的完整信息,请阅读 http://code.google.com/intl/es-ES/webtoolkit/articles/using_gwt_with_hibernate.html。
但总而言之,您将有 3 个选择:
根据我的经验,“神奇”的解决方案在发挥作用时是非常美妙的。如果他们不这样做,那么,祝你好运。所以如果我处于你的立场,我会选择选项 1 或选项 2。
GWT and Hibernate are NOT a natural match. For complete information about why and how you can work with both of them together, read http://code.google.com/intl/es-ES/webtoolkit/articles/using_gwt_with_hibernate.html.
But to sum it up, you will have 3 options:
In my experience, "magical" solutions are wonderful when they work. When they don't, well, good luck. So if I were in your shoes, I would pick either option 1 or 2.
简而言之,是的。
您似乎有两个要求:
丰富的用户界面:
您可能知道,GWT 可用于制作富 UI 应用程序。可能性几乎是无限的。
Hibernate 在第 1 点中不起任何作用。
可扩展性,
数据模型确实存在很大的开销,因为每个 Hibernate 实体在将其发送到客户端时都必须使用 GWT 模型进行映射。正如用户在上面指定的那样,有第三方应用程序可以帮助您执行此操作。添加新的数据模型将触发服务器和客户端代码的更改。然而,如果您的架构足够强大,这应该不是一个大问题。
In a nutshell, Yes.
You seem to have 2 requirements:
Rich user interface:
As you probably know, GWT can be used to make Rich UI applications. The possibilities is virtually endless.
Hibernate does not play any role in point 1.
Scalability,
There is indeed a great overhead with the datamodels since every Hibernate entity will have to be mapped with a GWT model when sending them to the client. As users have specified above, there are third party applications that help you do so. Adding new data models will trigger changes to both server and client code. However if your architecture is strong enought, this should not be a big issue.
是的,而且用得很多。基本上你有两个选择:
Yes, and it is used a lot. Basically you have a two options:
我认为 GWT 2.1+ 中已经解决的更好的解决方案是利用 RequestFactory 和 Entity/ValueProxy 机制。要更详细地了解 GWT 中的此习惯用法,请参阅此 http://code.google .com/webtoolkit/doc/trunk/DevGuideRequestFactory.html
I think a nicer solution that has been solved in GWT 2.1+ is by making use of RequestFactory and the Entity/ValueProxy mechanism. For more detailed understanding of this idiom in GWT refer to this http://code.google.com/webtoolkit/doc/trunk/DevGuideRequestFactory.html
这是一个非常好的架构,但您需要它才能完美匹配。
http://beanlib.sourceforge.net/
Is a really good architecture, but you will need this for a perfect match.
http://beanlib.sourceforge.net/
在考虑 GWT 应用程序时,吉利德误导最多。当将 GWT 应用程序设计为 3 层架构时,您首先会想到的是 Web 层是 gwt 生成的 JavaScript UI,应用程序层是您的 RPC 服务,但事实并非如此。两者都属于Web层。在考虑 Web 层时,您通常会对必须显示的数据进行数据转换。但使用吉利德时不会发生这种情况,你没有机会这样做。因此,当您当前将所有数据从数据库传输到 UI 时,我始终建议使用像 Dozer 这样的数据映射器。当您的应用程序增长时,您就需要进行转型!
Gilead missleads the most when thinking about GWT applications. When designing a GWT application as 3 tier architecture, the first you will think about is that the web tier is the gwt generated JavaScript UI and the application tier is your RPC service, but this is not the case. Both of them belongs to the web tier. When thinking about the web tier you would normally make a data tranformation to the data that has to be displayed. But this will not happend when using Gilead and you have no to chance to do this. So I would always recommend to use a data mapper like Dozer, also when you transfer currently all the data from the database to the UI. When your application grows the time will come where you need transformation!
当然是这样。
我制作了一个教程来帮助人们了解如何集成这些库。检查一下:
http ://singularityprogramming.wordpress.com/2012/04/06/gwt-2-4-0-hibernate-3-6-10-final/
Surely it is.
I make a tutorial to help people to know how to integrate the libs. Check it:
http://singularityprogramming.wordpress.com/2012/04/06/gwt-2-4-0-hibernate-3-6-10-final/