-
Oct 20th, 2011, 11:24 AM
#1
Lazy Loading changes from Spring Flex 1.0.3/BlazeDS 3 and Spring Flex 1.5/BlazeDS4
I have done an upgrade from Spring Flex 1.0.3/BlazeDS 3 to Spring Flex 1.5/BlazeDS4 and the Lazy loading behaviour has changed and now works as
Jeremy describes in thread: http://forum.springsource.org/showth...t=lazy+loading
>You need to use either SBI 1.5M2, or one of the latest 1.5 nightly builds in order to get Hibernate support out-of-the-box. That said, the way we approach it is rather different from the approach of >dpHibernate. We simply ensure that any uninitialized Hibernate proxies or collections get converted to null during serialization, allowing you to use the detached entity pattern without receiving >LazyInitializationExceptions. It is up to you to make additional remoting calls when you need to later retrieve the uninitialized portions of your object graph.
This is exactly the behaviour that I am getting now - lazy collections have a value of null.
Previously in Spring Flex 1.0.3/BlazeDS 3 when I retrieved a DTO with lazy one to many relationships, it retrieved all the data before it serialised back to the client and there
were no LazyInitialisation exceptions. This was done by adding a JPA OpenEntityManagerInViewFilter to the web.xml:
<filter>
<filter-name>JpaFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEnti tyManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>JpaFilter</filter-name>
<servlet-name>flex-admin</servlet-name>
</filter-mapping>
If the filter was not present, you would get the error "failed to lazily initialize a collection of role".
In Spring Flex 1.5/BlazeDS4, I guess I now have retrieve the lazy collections explicitly and the filter cannot be used to
resolve the lazy collections.
Is there a way that the filter to retrieve the lazy collections automatically can be used in a Spring Flex 1.5/BlazeDS4?
James
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules