本文介绍了GWT的Java数据库抽象(或者:Hibernate是不错的选择?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在用Google Web Toolkit开发某种企业资源管理系统。我们的主要目标是保持我们的系统的可扩展性,模块化和低成本。我们选择PostgreSQL作为我们的数据库,因为Oracle和MySQL太贵了。然而,我们对Oracle有很多经验。我们还需要为我们的数据库进行某种复制。



服务器后端将使用Java编写。



我们现在正在寻找一个好的数据库抽象。我们正在考虑Hibernate,但尽管可以在GWT中使用它,但我们不知道它是否是最好的选择。任何人都可以提供一些指针?有没有其他好的框架可供使用?也许我们会用JDBC编写所有代码,因为它速度快且可扩展,但这意味着更大的开发成本。但我们怀疑大数据表,我们对hibernate没有经验。



Hibernate的优点(我能想到):


  • 快速开发

  • 良好的文档

  • 稳定
  • 积极开发(我们不想使用由一个人开发的框架)
  • 支持是可以承受的(当所有错误都发生时)

  • 当我们有钱时,我们可以切换到Oracle(大型专业版)



缺点:


  • 可能无法扩展(不知道这是否为真)如果它崩溃,我们可能会被搞砸我们需要另一个体系结构层(您需要一些GWT的数据传输对象,因为hibernate持久化的类不能再序列化))


问候,

iuiz

解决方案

恕我直言hibernate最大的问题是:
1.性能问题比较到大量数据的原始JDBC。
2.涉及大对象图等的复杂映射问题。你会花很多时间配置你的域模型来正确地使用hibernate。



另一个选择是使用Spring的JDBC框架,它可以为你提供对象序列化hibernate的功能,以及对JDBC查询的更精细控制,并且更具扩展性,在我看来,开发起来更容易

we are currently developing some kind of enterprise resource managment system with Google Web Toolkit. Our main goals are to keep our system extend able, modular and our costs low. We choose PostgreSQL as our database, because Oracle and MySQL are just too expensive. However we have most experience with Oracle. We also need some kind of replication for our database.

The Server backend will be written in Java.

We are now looking for a good database abstraction. We were thinking of Hibernate, but although it is possible to use it with GWT, we don't know if it is the best choise. Can anyone give is some pointers? Are there any other good frameworks to use? Maybe we will code everything with JDBC, as it is fast and scalable, but this would mean bigger development costs. But we are suspecting big data table and we have no experience with hibernate.

Pros for Hibernate (that I can think of):

  • fast to develop
  • good documentation
  • stable
  • actively developed (we don't want to use frameworks that are developed by one person alone)
  • support is affordable (when all goes wrong)
  • we can switch to Oracle when we have the money for it (big pro)

Cons:

  • might not scale (don't know if this is true)
  • if it crashes we might be screwed (however it seems to be very stable)
  • we need another architecture layer (you need some kind data transfer objects for GWT, as hibernate persisted classes are not serializeable anymore source)

Greetings,

iuiz

解决方案

IMHO the biggest problem with hibernate are:1. Performance issues compared to Raw JDBC in high volumes of data.2. complex mapping issues when it comes to big object graphs and such. you would put a lot of time configuring your domain model to work correctly with hibernate.

the other alternative for you is to use Spring's JDBC frameworks that would give you the object serialization capabilities of hibernate with a more fine grained control over JDBC queries, and is more scalable and in my opinion much more easier to develop

这篇关于GWT的Java数据库抽象(或者:Hibernate是不错的选择?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 20:39