Hi All,

   Interestingly enough I happen to just run into the same problem myself
with one of my hibernated objects and cglib.  Matt I'm experiencing the same
problems (ClassCastException) when marshalling and I used your code below in
my getter method just to see if I could get past this problem.  Turns outs
after doing so it was able to marshall fine. 

For my particular case the get method in question was returning a proxied
hibernate object.  In reference to your comment Eitan, I'm not sure using
the "get-method" and "set-method" attribute would simple solve cases where
the method itself needs to return another hibernated proxied object.  I
think in such cases calling the get method doesn't return the concrete
implementation but instead the cglib proxied version of that object.  I was
under the impression that on calls to a proxied object to retrieve a simple
property such as a String, that is when the actual object is fetched.  I
believe hibernate waits until the last possible situation where it would
need to fetch before it actually returns a concrete class.  I think this
particular method would keep object graph traversal to a minimum in terms of
time and space.  Although I could be totally off as I'm not exteremly
familiar with the inner working of both hibernate & cglib.

In regarding a fix, while the code Matt submitted below worked when I added
it to my hibernate object, but I don't think it belongs there.  Although I'm
not sure where it could go as i'm just beginning to use jibx :)

Tom


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eitan Suez
Sent: Monday, May 22, 2006 4:45 PM
To: [email protected]
Subject: Re: [jibx-users] JIBX Hibernate CGLIB

On Mon, 2006-05-22 at 11:13 -0400, Matt MacDonald wrote:
> Hi Dennis,
> 
> I followed your advice and the getCreator() method is returning a  
> UserImpl$$EnhancerByCGLIB$ but could JIBX be modified to use the  
> following bit of code to solve this:
> 
> if (proxy instanceof HibernateProxy){
>     return ((HibernateProxy)proxy).getHibernateLazyInitializer 
> ().getImplementation();
> }
> 
> or does the fix belong in either my Hibernate Mapping code or  
> Hibernate itself?

i was thinking..the cglib proxies are usually there for the
purpose of introducing lazy behavior.  that is, the actual
implementation isn't fetched until a getter or iterator is
invoked.  so i'm wondering whether revising a jibx mapping
to use the "get-method" and "set-method" attributes in liue of
"field" might not resolve this particular issue.

thanks, / eitan



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to