Why can’t NHibernate open a new connection (or session) if it has to lazy-load associations?First, we think it’s a better solution to fully initialize all required
objects for a specific use case using eager fetching (this approach is
less vulnerable to the n+1 selects problem). Furthermore, opening
new database connections (and ad hoc database transactions!)
implicitly and transparently to the developer exposes the application
to transaction isolation issues. When do you close the session and
end the ad hoc transaction—after each lazy association is loaded?
We strongly prefer transactions to be clearly and explicitly
demarcated by the application developer. If you want to enable lazy
fetching for a detached instance, you can use Lock() to attach it to a
new session.
这段话看得不是很懂,哪位高手帮我解释一下,用自己的理解也行。
objects for a specific use case using eager fetching (this approach is
less vulnerable to the n+1 selects problem). Furthermore, opening
new database connections (and ad hoc database transactions!)
implicitly and transparently to the developer exposes the application
to transaction isolation issues. When do you close the session and
end the ad hoc transaction—after each lazy association is loaded?
We strongly prefer transactions to be clearly and explicitly
demarcated by the application developer. If you want to enable lazy
fetching for a detached instance, you can use Lock() to attach it to a
new session.
这段话看得不是很懂,哪位高手帮我解释一下,用自己的理解也行。
解决方案 »
- 如何判别线程池里的任务全部已经完成?
- 射映错误
- 请问下面2句sql有什么不同?那个效率更高
- 急!!!hibernate初始化问题
- 用web service 上传和文件速度快吗?能传多大的文件呢?
- hibernate调用函数为什么不能返回值??
- 最近看了RMI,出略的总结了一下RMI的执行过程,不知道对不对。请大虾指正
- 高手,我安装了jbuilder9,还要不要安装j2ee1.4呀
- 如何使用hibernate数据库映射工具Middlegen-Hibernate来对数据库进行映射?????
- 请教struts中html标记库下拉列表框的使用,在线等,急.......
- 问个struts的简单问题
- 问:Struts2.0 关于重定向的问题
首先,我们认为这是一个更好的解决办法来充分的初始化所有必需的
对象为某一特定的用例使用这种方法(渴望获取
那么容易受到了n + 1选择问题)。另外,
新的数据库连接(和特设数据库事务!)
隐和透明的开发应用。暴露
对事务隔离问题。当你关闭对话和吗
最后transaction-after特设的每一个懒惰的关联上吗?
我们极力要清晰和明确的交易
由应用程序开发者划定。如果你想使懒惰
取一个超然的情况下,你可以使用锁()将一个
新的会话。