Topic: 牛人来讨论讨论hibernate |
Print this page |
1.牛人来讨论讨论hibernate | Copy to clipboard |
Posted by: supertoy Posted on: 2003-06-10 00:20 用了一段时间,感觉还挺好,不过现在有些犹豫要不要在项目里用了。好处是 1。通过自己定义的query语言来操作数据,不需要为每各种数据库作一种实现了,比较好。(不过实际情况,以前做的应用把sql提到文件里,再避免些复杂sql,移植起来也飞快。) 2。好像对对象的缓存做得不错,测了一下,模拟多个用户循环调用的情况比自己写jdbc快,量越大越明显,不知道原因。 3。最重要一点,hibernate的用户群很广,发展势头好。 4。可以启用cache 不好的地方. 1.query语言支持有限,比如substring这样常用的东西都找不到。 2.查询返回为collection的时候处理不好。比如select cat.id, cat.name from Catgeory cat这样的查询,返回的list里面的每个object居然是object数组,没有自动转换成对应的实体类(只要用了select就这样)。 3。最重要一点,写起来不够简洁,不像以前自己封转的那些jdbc操作那么简单。 有点头痛,不知道该不该用。现在的应用大部分是单表的CRUD,不需要那么复杂的。 |
2.Hibernate 2.0 final Released [Re: supertoy] | Copy to clipboard |
Posted by: why Posted on: 2003-06-10 07:54 From: http://www.theserverside.com/home/thread.jsp?thread_id=19732 Hibernate 2.0, the open source persistence framework, has been released. Hibernate2 features substantial redesign in: - id generator framework - configuration APIs - interceptor - callbacks - collections - package organization - naming exception model - new mapping format - new "cool" features Hibernate2 is not a drop-in replacement for Hibernate 1.2. Code changes will certainly be required. However, we expect that these changes will be of the trivial, automatable variety and that no application redesign will be necessary (unless you are using toplevel collections). See More -------- Hibernate Home Page Hibernate Feature List |
3.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: supertoy Posted on: 2003-06-10 10:13 对我一点帮组都没有,我感觉做多表的时候很方便,单表体现不出太多好出来。 ps,问个问题,比如一对多的时候。department - employee ,因为这个多太多了,我要求分页load出来,好像就没有办法了,还是要写code,不过比写jdbc容易一点。 还有多对一的情况,上面那个,是不是每个employee都会retrieve然后生成一个 department对象,还是大家共享一个? |
4.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: floater Posted on: 2003-06-10 23:21 supertoy wrote: Agreed. I wrote a similar engine several years ago which takes sql statements/stored procedures and returns results back. However the difference is below.
This is the difference - caching. If you have much more read than write, then use this or write your own caching. 3。最重要一点,hibernate的用户群很广,发展势头好。 4。可以启用cache 不好的地方.
This is not good, anyway to get around/propose a new feature??
This is bad too, so we have to write a utiility class to convert them.
Whatever way you want to go, you should always shield out db with your interfaces. If you think your old jdbc interfaces are good, extract them out so you can implement these with jdbc or hibernate or whatsoever, then you don't need to worry about the underlying dependencies at all. I like the hibernate style, it works in a way that our developers expect. But whether we use it in an application or not is app-dependent. In the book: Expert One-on-One J2EE, there is a thread talking about database layer, you may take a look. (It's using jdbc, but no cache.) |
5.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: supertoy Posted on: 2003-06-11 09:11 我以前的引用都是自己写了一个工具类,传sql返回对象集合,也封装了分页处理之类的东西,比用hibernate确实简单一些。hibernate每个对象必须配置xml文件,上百张表的时候就很恐怖了 |
6.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: floater Posted on: 2003-06-12 02:48
Well, at least you don't need to write code. If you write any number of lines of code, you need to test & migrate it. If you don't do this, then you have to do something else, and it's more or less the same. |
7.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: HenryYu Posted on: 2003-07-01 17:51 唉,关于数据持久层的设计和实现的问题不知道什么时候才有一个统一的模式, jdbc+session bean,entity bean,jdo,hibernate。。。对我们做系统集成的开发人员来说,实在没有精力研究那么心细,往往现成的就拿来用,就想entity bean刚出来是多火,大家都是赞声一片,现在却失宠了,jboss都改用jdo了,面对网上的讨论,而自己又没时间研究,确实在开发新的项目时候,也很是迷茫呀! |
8.Re:牛人来讨论讨论hibernate [Re: supertoy] | Copy to clipboard |
Posted by: l_walker Posted on: 2003-07-02 13:30 学习中 |
9.Re:牛人来讨论讨论hibernate [Re: HenryYu] | Copy to clipboard |
Posted by: yadan Posted on: 2003-07-02 15:16 HenryYu wrote: 真的? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |