开发者

A little bit diffrent GWT/GXT persistent approach

开发者 https://www.devze.com 2023-02-03 22:24 出处:网络
I\'m newbie with GWT/GXT and I\'m looking for best persistence way for my future apps. I was considering many variants of doing that so I decided to draw a graph here:

I'm newbie with GWT/GXT and I'm looking for best persistence way for my future apps. I was considering many variants of doing that so I decided to draw a graph here:

A little bit diffrent GWT/GXT persistent approach

So my conclusions are:

1) JPA/Hibernate is the best persistence framework but it hates cooperation with GWT and a specially with GXT

2) JDBC it was just an example joke :)

3) MyBatis is really great tool for gaining data from db, its fast, efficient and has great possibilities not seen in Hibernate, but writing mappers is the worst thing ever.

4) Dozzer is server and user resourcess killer. You must write a lot of boiler plate code and it just copy data (sometimes a lot). Don't use it at any cost!!! Imagine server that runs 100 sessions and each bean request must use Dozzer.

5) DTO - similar situation. It's boilerplate, and开发者_开发百科 it's just transforming one data type into other. There is no serious data processing. Use server resourcess wisely.

6) Gilead is copying hibernate beans states. It could be dangerous (just heard from few comments), hard to configure and integrate with other IoC frameworks (Guice in my case).

7) Don't transform POJO into BeanModel on the client side. JavaScript is really slow and it slows down the whole client.

8) Best practise for me and maybe for you: find the shortest path on the graph from DB to the BaseModel bean on the client side.

9) MyBatis allows to map query results to the BaseModel beans (tested) so they don't need to be transformed many times and you don't have to care about it at all. The only thing is writing proper mappings.

This is my personal opinion but I would like to know your opinion. Please explain me if I'm wrong and give cons arguments. I would really like to use Hibernate or maybe you know another ORM or similar to MyBatis framework that could give me direct mapping to the BeanModel.

For my purpose I'm going to develop app that would generate for me domain classes in BaseModel style with mappers, validators, editors, advanced search panels, DAOs, services and GWT-RPC classes. The best solution would be to develop own scaffolding :D. What do you think about it?


ya develop your own scaffolding..that's what i did. Here is my flow DB-> JPA -> Entity Beans -> My own Converter Class -> BaseModel

In my application the BaseModel is serving as the DTO. In the GWT RPC service i convert the BaseModel to Entity Bean and Entity Bean to BaseModel as needed.

-Zawoad


Maybe have a look at GWT RequestFactory. It's a new feature in 2.1

http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

I personally use Gilead and have not had any problems with it, no major configuration necessary. I do not do much lazy loading of collections. I just designed my use cases with that thought in mind.


Has anyone tried to use hibernate's Dynamic Models, it looks like you should be able to map straight to the GXT BaseModel. See: Hibernate Dymanic Models Section


I used MyBatis with GWT and I was satisfied, because MyBatis uses only POJOs, so that objects are easyly transfered between client and server (no more DAO, DTO). You can use MyBatis's annotation if you don't like write XML mappers, I like its simple. So my recommendation is MyBatis

0

精彩评论

暂无评论...
验证码 换一张
取 消