cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject SOLVED! — Re: Hibernate + Flowscript = trouble? Help!
Date Wed, 22 Jun 2005 15:25:21 GMT

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—

Mime
View raw message