We haven't released the source for blazeds yet but it is coming.  It
does not contain any AS source generation but I think that is easy to
layer on and there are a bunch of decent implementations out there.
There is better support for customizing the serialization process in
blazeds (improved over 2.5.1).  The beta for blazeds has some of this
but we are adding even more between beta and the release.  

 

Implementing lazy loading is a bit of a pain with hibernate if you have
to do it using remote object.  There are two major issues:

 

1)       the class names of the generated wrapper classes used by
hibernate mess up the mapping of the class names used to find the right
AS class.  This one is easy to get around with this PropertyProxy
mechanism.   In fact, LC DS contains the source to a PropertyProxy
implementation (HibernatePropertyProxy.java) which you can use with
remote object to strip the generated class name off before
serialization.  This has the side effect of returning empty versions of
all non-loaded lazy properties which brings us to problem 2).  Note that
hibernate has different mechanisms for doing the lazy loading.. it can
do byte code modification but I haven't used that technique so I'm not
sure how it works here. 

2)       If you did not fetch a property with lazy="true" in hibernate
before the session is closed, the attempt to access that property during
serialization fails with the "session closed" error.  To get around
this, you can make sure you access all properties you need before the
serialization.. this is the approach used by LC DS but because it has a
model of the association properties, you don't have to code it up
yourself.  It is done by the assembler so it is automatic.    Another
hacky approach is to put a servlet filter in which opens up a hibernate
session before calling the MessageBrokerServlet, then close the session
once it returns.  That means you lose control over the hibernate
sessions in your application and you have a transaction which is open
for the entire duration of the request which is not very flexible.
There might also be performance problems if you have a
session/transaction open while you are doing I/O.  Not sure that will be
a problem but these are the reasons we went with the "prefetch"
mechanism in LC DS's hibernate assembler.

 

 In terms of the issues with hibernate in 2.5 and earlier versions, one
of the trickiest things is that you need to make your
data-management-config.xml match up with the hibernate config.  We're
hoping to get a chance into a future version which makes this not
necessary since the configs are pretty similar.  You also need to do the
AS code which matches the Java code yourself (or use a 3rd party code
gen tool).  

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of andrii_olefirenko
Sent: Friday, January 11, 2008 5:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Flex + Spring + Hibernate -> Lazy=true

 

Assemblers are more for CRUD apps. And even with Hibernate assembler, 
i haven't achieved lazy loading (it was old version of FDS and maybe 
i didn't try hard but anyway). 
If anyone has been able to implement lazy loading with LCDS 2.5, let 
me know so at least i will be assured that this is possible :)
in addition to lazy loading, there are also problems of multiple 
instances if the same object, and the need to manually write 
actionscript counterparts of java objects. IFAIK, there no tool for 
automated generation AS3 classes out of java classes in BlazeDS. For 
big projects with permanent changes to the objects it is pain to 
manually maintain both AS3 and java obejcts sync.

it would be nice to implement all these features in open-sourced 
BlazeDS, but i didn't find any source code in distribution as for 
now. 
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Rodrigo Pereira 
Fraga" <[EMAIL PROTECTED]> wrote:
>
> Oh my god!!!!
> 
> =/
> 
> But who uses the LCDS, it does not contain a "HibernateAssembler" 
> which implements the use of lazy?
> 
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "andrii_olefirenko" <andriyo@> 
> wrote:
> >
> > BlazeDS (and LCDS as far as i remember) doesn't support this out 
of 
> > box. There are workarounds like 1) make you own DTO (hibernate 
> free) 
> > 2) prefetch object dependencies 3) include metadata about lazy 
> > properties with you objects, control externalization to handle 
> > objects with metadata and so on. 
> > if you develop with Hibernate (or EJB3), lack of lazy object 
> support 
> > makes BlazeDS simply unusable for real enterprise application 
devs.
> > 
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Rodrigo Pereira Fraga" 
> > <rpffoz@> wrote:
> > >
> > > Someone has some solution to use the Pattern OpenSessionInView 
> with 
> > > Flex using BlazeDS? 
> > > 
> > > I am using Spring and it contains a OpenSessionInViewFilter 
used 
> in 
> > > web.xml, and a OpenSessionInViewInterceptor. But it is 
different 
> > with 
> > > Flex +) 
> > > 
> > > Someone has idea of how I can use the Lazy = true to hibernate 
> with 
> > the 
> > > Flex + Spring?
> > > 
> > > 
> > > 
> > > Atenciosamente:
> > > -------------------------------------------------------
> > > | Rodrigo Pereira Fraga |
> > > http://www.digows.com <http://www.digows.com>  
> > > 
> > > e-mails: rpffoz@
> > > rfraga@
> > > -------------------------------------------------------
> > >
> >
>

 

Reply via email to