Java database abstraction for GWT (or: Is Hibernate a good choice?)
we are currently developing some kind of enterprise resource managment system with Google Web Toolki开发者_开发百科t. 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
Hibernate is complicated if you go beyond simple queries, Hibernate also does some lazy loading and that will not work very well with GWT unless you understand the intricacies of both.
My suggestion to you is to use straight JDBC and layer the Data Access Layer so that you can easily put in something else later if you feel you need to.
"we need another architecture layer (you need some kind data transfer objects for GWT, as hibernate persisted classes are not serializable anymore)"
Check out Gilead
Hibernate is too much complicated. Try MyBatis with Guice and MyBatis-Guice. Also check this out: A little bit diffrent GWT/GXT persistent approach
精彩评论