On Igenko (http://code.google.com/p/igenko/), we have began to work on
Jcrom lazy loading support for GraniteDS. This functionality is
critical for Igenko, but it is also quite complicated because it touch
really low levels things, and it requires a good knowledge of both
GraniteDS and Jcrom framworks.
The aim of this cross project message is to share with you what I have
understood, to have feedback from both GraniteDS and Jcrom developers.
To quickly summarize usage of each framework in Igenko :
GraniteDS is used to expose our Java POJOs on Flex side. It already
supports Hibernate lazy loading
(http://www.graniteds.org/confluence/display/DOC11/2.4.5.+Lazy+Initialization).
Source code of Hibernate lazy loading support is available here :
http://granite.svn.sourceforge.net/viewvc/granite/graniteds/trunk/hibernate/org/granite/hibernate/
Instead of using a relational datase + Hibernate, we store datas in a
Java Content Repository, witch is like a hierarchical database that
store Nodes and Properties. More details on
http://en.wikipedia.org/wiki/Content_repository_API_for_Java.
Jcrom is a JCR Object Mapper, and it does for JCR what Hibernate did
for JDBC. A quick overview of lazy loading support in Jcrom, based on
Cglib is available here :
http://code.google.com/p/jcrom/source/detail?r=106
I have looked at the files from GraniteDS Hibernate support to
identify all dependencies to Hibernate or EJB3 classes, and I try to
find Cglib equivalent to hibernate classes. I have written bellow my
remarks and questions for each GraniteDS class from Hibernate lazy
loading support.
HibernateClassGetter
Used to retreive to original class name for proxifed objects. It uses
the following Hibernate classes :
- org.hibernate.proxy.LazyInitializer : used to retreive to original
class name for proxifed objects. Perhaps we could use some Jcrom
mapping class that have the same functionnality ?
- org.hibernate.proxy.HibernateProxy : Used to retreive
LazyInitializer. The matching class in cglib seems to be
net.sf.cglib.proxy class ...
HibernateProxyInstanciator
Create a new instance of HibernateProxy
ProxyFactory
Get an existing instance of HibernateFactory. I have not understood
how this class work because it uses a lot of reflection.
HibernateExternalizer
Used to (de)serialize private or protected fields
The isRegularEntity methods should be change to support Jcrom JcrNode
annotation.
Same problem that previously, we should find replacement for
LazyInitializer and HibernateProxy hibernate classes.
HibernatePersistentCollections
There are Java and Flex wrappers for lazy loaded hibernate
collections. I don't think we have wrappers for Jcrom lazy loaded
collections. Do we need some collection wrappers too ?
I have put bellow links to Cglib and Hibernate documentation for
classes that we use.
Hibernate documentation :
LazyInitializer :
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/proxy/LazyInitializer.html
HibernateProxy :
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/proxy/HibernateProxy.html
Cglib documentation :
Proxy : http://cglib.sourceforge.net/apidocs/net/sf/cglib/proxy/Proxy.html
Enhancer : http://cglib.sourceforge.net/apidocs/net/sf/cglib/proxy/Enhancer.html
LazyLoader : http://cglib.sourceforge.net/apidocs/net/sf/cglib/proxy/LazyLoader.html
Any help appreciated.
Regards