ORM概念的一些问题....你怎么看? [英] some problems with ORM concept....what do you think?

查看:85
本文介绍了ORM概念的一些问题....你怎么看?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我搜索过的所有ORM,我总是发现两个大问题:


1)要更新或删除一组记录,必须先将它带到内存中。

如果你在一个循环中并且必须做n次,那么你必须查询

这个设置n次。如果ORM可以更容易(以

强类型方式)调用动态查询来直接更新/删除

记录,那就太好了。


2)我注意到所有ORM都使用集合作为

查询的返回数据类型。那么,你不能添加,删除,替换或重新排序这个

集合中的元素......这限制了你工作的方式很多,特别是如果你是

在循环中迭代并且必须对同一个表进行更改

迭代...


您对此有何看法?

For all the ORM i have searched around, I have always found two big problems:

1) To update or delete a set of records you must first bring it to memory.
If you are inside a loop and have to do it n times, then you have to query
this set n times as well. Would be nice if ORM could make it easier (in a
strongly type manner) to call a dynamic query to directly update/delete
records.

2) I have noticed all ORM work with collection as thei return datatype of a
query. Well, you cannot add, delete, replace, or reorder the elements in this
collection...this restrict a lot the way you can work, specially if you are
iterating in a loop and have to make changes to the same table you are
iterating...

What are your opinions about it ?

推荐答案

当然,您可以在NHibernate中使用HQL完成所有这些工作。


J.

Bruce One写道:
Sure you can do all of that with HQL in NHibernate.

J.

Bruce One wrote:

对于我搜索过的所有ORM,我总是发现两个大问题:


1)要更新或删除一组记录,首先必须将其带入内存。

如果你在一个循环中并且必须这样做n次,那么你必须查询

这个设定也是n次。如果ORM可以更容易(以

强类型方式)调用动态查询来直接更新/删除

记录,那就太好了。


2)我注意到所有ORM都使用集合作为

查询的返回数据类型。那么,你不能添加,删除,替换或重新排序这个

集合中的元素......这限制了你工作的方式很多,特别是如果你是

在循环中迭代并且必须对同一个表进行更改

迭代...


您对此有何看法?
For all the ORM i have searched around, I have always found two big problems:

1) To update or delete a set of records you must first bring it to memory.
If you are inside a loop and have to do it n times, then you have to query
this set n times as well. Would be nice if ORM could make it easier (in a
strongly type manner) to call a dynamic query to directly update/delete
records.

2) I have noticed all ORM work with collection as thei return datatype of a
query. Well, you cannot add, delete, replace, or reorder the elements in this
collection...this restrict a lot the way you can work, specially if you are
iterating in a loop and have to make changes to the same table you are
iterating...

What are your opinions about it ?


我可能对我真正意义上的内容有所了解。

我的意思是所有ORM都有下面这两个问题...

Hibernate(我已经研究过)以这种方式工作,即

它必须将所有需要更新/删除的记录带入内存,并且,因为

它适用于集合,你只是无法更新/删除这个

集合的任何成员,这样集合就会丢失....


Jimmy写道:
I may have misexposed what I really meant.
I meant all ORM do HAVE these 2 problems below...
Hibernate (which I have already studied) works exaclty this ways, that is,
it has to bring to memory all records it needs to update/delete, and, since
it works with collections, you just cant update/delete any member of this
collection in such a way the collection gets "lost"....

"Jimmy" wrote:

当然你可以在NHibernate中用HQL完成所有这些。


J.


Bruce One写道:
Sure you can do all of that with HQL in NHibernate.

J.

Bruce One wrote:

对于我搜索过的所有ORM,我总是发现两个大问题:

1)要更新或删除一组记录,首先必须将它带到内存中。

如果你在循环中并且必须做n次,那么你必须查询

这套也是n次。如果ORM可以更容易(以

强类型方式)调用动态查询来直接更新/删除

记录,那就太好了。


2)我注意到所有ORM都使用集合作为

查询的返回数据类型。那么,你不能添加,删除,替换或重新排序这个

集合中的元素......这限制了你工作的方式很多,特别是如果你是

在循环中迭代并且必须对同一个表进行更改

迭代...


您对此有何看法?
For all the ORM i have searched around, I have always found two big problems:

1) To update or delete a set of records you must first bring it to memory.
If you are inside a loop and have to do it n times, then you have to query
this set n times as well. Would be nice if ORM could make it easier (in a
strongly type manner) to call a dynamic query to directly update/delete
records.

2) I have noticed all ORM work with collection as thei return datatype of a
query. Well, you cannot add, delete, replace, or reorder the elements in this
collection...this restrict a lot the way you can work, specially if you are
iterating in a loop and have to make changes to the same table you are
iterating...

What are your opinions about it ?



Bruce One< ra ** @ virtualsoftware.com.brwrote:
Bruce One <ra**@virtualsoftware.com.brwrote:

我可能会错误地说出我的意思。

我的意思是所有ORM都有以下这两个问题...

Hibernate(我有)已经研究过了这种方式很有效,也就是说,它必须将所有需要更新/删除的记录带到内存中,并且,因为

它适用于集合,你不能更新/删除这个

集合的任何成员,这样集合就会丢失....
I may have misexposed what I really meant.
I meant all ORM do HAVE these 2 problems below...
Hibernate (which I have already studied) works exaclty this ways, that is,
it has to bring to memory all records it needs to update/delete, and, since
it works with collections, you just cant update/delete any member of this
collection in such a way the collection gets "lost"....



不,Hibernate(至少Java版本)*不必*获取

记录以更新/删除它们。


参见
http://www.hibernate .org / hib_docs / v3 ... tch.html#batch

-direct


又名 http://tinyurl.com/4kpug


并向下滚动到DML风格的操作。


-

Jon Skeet - < sk *** @ pobox.com>
< a rel =nofollowhref =http://www.pobox.com/~skeettarget =_ blank> http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复该组,请不要给我发邮件

No, Hibernate (at least the Java version) does *not* have to fetch
records in order to update/delete them.

See
http://www.hibernate.org/hib_docs/v3...tch.html#batch
-direct

aka http://tinyurl.com/4kpug

and scroll down to "DML-style operations".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


这篇关于ORM概念的一些问题....你怎么看?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆