原文链接:http://forum.springsource.org/showthread.php?t=71622
Hi,
We have faced an issue on lazy loading Domain Objects with Hibernate in n-tier architecture with Spring BlazeDS.
Our architecture is just a basic Spring architecture model:
- Flex Client
- Web layer (includes BlazeDS configuration)
- Service layer
- HIbernateDAO+Domain model
For example, if we want to load this domain object
// example...
public class Customer {
private List<Order> orders;
private Address address
// getters & setters
}
Orders and Address -fields are marked with lazy fetch. So when we simply load Customer, orders aren`t loaded at the same time, they are just Hibernate proxies. Hibernate session is closed after DAO layer.
Service layer gets the Customer object from DAO layer. Flex client requests the service layer method with some parameters trough BlazeDS and service layer returns the Customer to Flex.
And now comes the problem: lazyInitException.
After some searching and googling we founded out this: BlazeDS doesn`t recognize lazy fields (Hibernate proxies) and gives the error.
Possible solutions were:
a) change your architecture so, that you can use Open Session View Pattern
b) mark all lazy fields (Hibernate proxies) to null on service layer
c) use the Data Transfer Object anti-pattern: do not return any domain object to Flex, create matching DTO`s (for example CustomerDTO) and transform your domain objects to DTO on service layer.
分享到:
相关推荐
j2ee建工程需要的flex.war flex.war&blazeds.war&samples.war&flex-admin.war
abode flex BlazeDS 源码
BlazeDS通信到Java的PureMVC——Flex框架,BlazeDS的服务器配置比较麻烦,这里使用的是直接下载blazeds_turnkey_3-0-0-544.zip中的tomcat BlazeDS模板路径为: blazeds_turnkey_3-0-0-544.zip解压后路径\tomcat\...
Spring和Adobe Flex的开发技术文档。
PureMVC Flex BlazeDS Spring Hibernate 框架整合开发
一个 Flex+J2EE实例(cairngorm+blazeDS+hibernate+spring) 本实例为一个 flex 与 java通信项目。前端采用cairngorm框架,后台 采用hibernate+spring 每个部署 步骤,附详细 图文解释。旨在 采用 一种快速开发 ...
自己写的一个Flex+J2EE实例(cairngorm+blazeDS+hibernate+spring)part1.pdf
网络上好多Myeclipse8.5+flex4.5+Blazeds+SSH环境搭建及实例,个人实验过程中出现了不少问题,通过从网络上搜索各种资源,最后成功整合,以供大家学习。当然,还有部分内容没有修改完,但至少能够成功运行
Flex+J2EE实例(cairngorm+blazeDS+hibernate+spring) part4.pdf 终结版
包含blazeds-common-4.0.0.14931.jar、blazeds-core-4.0.0.14931.jar、blazeds-proxy-4.0.0.14931.jar、blazeds-remoting-4.0.0.14931.jar
blazeds, flex 于 JAVA 交互插件
Flex+J2EE实例(cairngorm+blazeDS+hibernate+spring) part3.pdf 第三部分。。add spring and hibernate
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
Flex PureMVC Flex BlazeDS Spring Hibernate 整合 里面一些图标是包双击可查看源代码
自己写的一个Flex+J2EE实例(cairngorm+blazeDS+hibernate+spring) part2.pdf 这个是第二部分,循序渐进,让初学者慢慢掌握搭框架的方法
Spring BlazeDS Integration 1.0.0
blazeds-turnkeyblazeds-turnkeyblazeds-turnkeyblazeds-turnkey
完整的blazeds包, 包含blazeds.war,ds-console.war,samples.war三个文件
blazeds-bin-3.3.0.22497.zip