You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2005/06/22 17:25:21 UTC

SOLVED! — Re: Hibernate + Flowscript = trouble? Help!

On Jun 21, 2005, at 10:40 PM, Mark Lundquist wrote:

> Hi all,
>
> I got a really nasty bug goin' on here.
>
> An object percolating up into flow from my model layer was retrieved 
> by Hibernate, and I'm getting the old "TypeError: xxxx is not a 
> function.", and of course it is a public function in a freshly cleaned 
> and compiled class in a cold-started Jetty instance (i.e. my usual 
> dumb-@$$ reasons for this error already checked :-).
>
> I have my flowscript print the object, and it's of the type I expect:
>
> 	us.rocketsurgery.ecommerce.creditcards.CreditCardPayment@2eda5e
>
> ...or so it would seem.  But if I say this:
>
>    print (order.payment.getClass().getName());
>
> ...then I get this:
>
> 	us.rocketsurgery.ecommerce.payment.Payment$$EnhancerByCGLIB$$309df4c3
>
> OK, now maybe we are getting somewhere — Payment is the abstract base 
> class of CreditCardPayment, and I've got a CGLIB proxy from Hibernate. 
>  I guess Rhino has to reflect on the object to wrap it, and this is 
> screwing it up.

I've been rummaging around in the innards of Hibernate this morning to 
see if maybe that proxy holds some deep, helpful secrets :-)... and 
came up with a fix/workaround.  I tried this in my flowscript:

	order.payment = 
order.payment.getHibernateLazyInitializer().getImplementation();

Wahoooo!!!!!!!  It works!!!

"I'm an evil Ho-MER!"
"I'm an evil Ho-MER!"

:-) :-) :-) :-)
—ml—