You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ted Steen <te...@gmail.com> on 2006/01/09 19:44:01 UTC
problem with HibernateSqueezer
there is a problem with the HibernateSqueezer (
http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
sometimes Hibernate extends the persistent classes, this probably has
something to do with caching.. anyway, this is an example of what
data.getClass().getCanonicalName()
could return;
a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
so it is going to unsqueeze to null...
this seems like a rather common problem (it should have happend to
them who is using the HibernateSqueezer) anyone know a solution?
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: problem with HibernateSqueezer
Posted by Olve Hansen <ol...@intermedia.uib.no>.
man, 09,.01.2006 kl. 19.44 +0100, skrev Ted Steen:
> there is a problem with the HibernateSqueezer (
> http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
>
> sometimes Hibernate extends the persistent classes, this probably has
> something to do with caching.. anyway, this is an example of what
> data.getClass().getCanonicalName()
> could return;
> a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
>
> so it is going to unsqueeze to null...
>
> this seems like a rather common problem (it should have happend to
> them who is using the HibernateSqueezer) anyone know a solution?
>
We fixed this problem with a rather cruel hack, but it works:
In unsqueeze:
...
psf String CGLIB_TOKEN = "CGLIB";
psfs CGLIB_ADDED_SIGNS ="$";
...
public Object unsqueeze(DataSqueezer squeezer, String string)
{
...
String classname = parts[1];
if(classname.indexOf(CGLIB_TOKEN) > 0)
classname = classname.substring(0,
classname.indexOf(CGLIB_ADDED_SIGNS));
...
}
We have modified the squeezer example in the wiki a bit, but you should
be able to get the general idea of it.
Dunno what will happen if we turn of CGLib enhancement in Hibernate
though. Not tested yet :-)
HTH.
Re: problem with HibernateSqueezer
Posted by Ted Steen <te...@gmail.com>.
I`ll go with the getSuperclass() solution..
thanks!
On 1/10/06, Ido M. Tamir <ta...@imp.univie.ac.at> wrote:
> On Monday 09 January 2006 13:44, Ted Steen wrote:
> > there is a problem with the HibernateSqueezer (
> > http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
> >
> > sometimes Hibernate extends the persistent classes, this probably has
> > something to do with caching..
> no not caching, minimizing database roundtrips and joins.
> > anyway, this is an example of what
> > data.getClass().getCanonicalName()
> > could return;
> > a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
> >
> > so it is going to unsqueeze to null...
> >
> > this seems like a rather common problem (it should have happend to
> > them who is using the HibernateSqueezer) anyone know a solution?
> This is actually more a hibernate problem.
> What do you actually need?
> Either you squeeze it without the proxy:
> You get a baseclass of a cglib proxy with something similar to:
> Class clazz = object.getClass();
> if(object instanceof Factory) {
> clazz = clazz.getSuperclass();
> }
> }
>
> Or you play around with strings.
>
> I hope you dont run into a lazyinitializationexception.
> Above was guessed and not tested.
>
> hth
> ido
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: problem with HibernateSqueezer
Posted by "Ido M. Tamir" <ta...@imp.univie.ac.at>.
On Monday 09 January 2006 13:44, Ted Steen wrote:
> there is a problem with the HibernateSqueezer (
> http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
>
> sometimes Hibernate extends the persistent classes, this probably has
> something to do with caching..
no not caching, minimizing database roundtrips and joins.
> anyway, this is an example of what
> data.getClass().getCanonicalName()
> could return;
> a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
>
> so it is going to unsqueeze to null...
>
> this seems like a rather common problem (it should have happend to
> them who is using the HibernateSqueezer) anyone know a solution?
This is actually more a hibernate problem.
What do you actually need?
Either you squeeze it without the proxy:
You get a baseclass of a cglib proxy with something similar to:
Class clazz = object.getClass();
if(object instanceof Factory) {
clazz = clazz.getSuperclass();
}
}
Or you play around with strings.
I hope you dont run into a lazyinitializationexception.
Above was guessed and not tested.
hth
ido
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: problem with HibernateSqueezer
Posted by Richard Clark <rd...@nextquestion.net>.
On Jan 9, 2006, at 10:44, Ted Steen wrote:
> there is a problem with the HibernateSqueezer (
> http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
>
> sometimes Hibernate extends the persistent classes, this probably has
> something to do with caching..
If you're using collections, your classes will get extended to
implement "lazy loading". As far as I can tell, caching does not
require class extension.
...Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: problem with HibernateSqueezer
Posted by Ted Steen <te...@gmail.com>.
the source is right here;
http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer
On 1/9/06, Patrick Casey <pa...@adelphia.net> wrote:
>
> You could set proxy=false in your hibernate mapping to prevent this
> kind of class enhancement, but you'd take a serious performance hit. Without
> seeing the source for the hibernate squeezer I can't offer a solution on
> that end.
>
> --- Pat
>
> > -----Original Message-----
> > From: Ted Steen [mailto:ted.steen@gmail.com]
> > Sent: Monday, January 09, 2006 10:44 AM
> > To: Tapestry users
> > Subject: problem with HibernateSqueezer
> >
> > there is a problem with the HibernateSqueezer (
> > http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
> >
> > sometimes Hibernate extends the persistent classes, this probably has
> > something to do with caching.. anyway, this is an example of what
> > data.getClass().getCanonicalName()
> > could return;
> > a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
> >
> > so it is going to unsqueeze to null...
> >
> > this seems like a rather common problem (it should have happend to
> > them who is using the HibernateSqueezer) anyone know a solution?
> >
> >
> > --
> > /ted
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
/ted
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: problem with HibernateSqueezer
Posted by Patrick Casey <pa...@adelphia.net>.
You could set proxy=false in your hibernate mapping to prevent this
kind of class enhancement, but you'd take a serious performance hit. Without
seeing the source for the hibernate squeezer I can't offer a solution on
that end.
--- Pat
> -----Original Message-----
> From: Ted Steen [mailto:ted.steen@gmail.com]
> Sent: Monday, January 09, 2006 10:44 AM
> To: Tapestry users
> Subject: problem with HibernateSqueezer
>
> there is a problem with the HibernateSqueezer (
> http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer )
>
> sometimes Hibernate extends the persistent classes, this probably has
> something to do with caching.. anyway, this is an example of what
> data.getClass().getCanonicalName()
> could return;
> a.b.c.PersistentClass$$EnhancerByCGLIB$$971b2e13
>
> so it is going to unsqueeze to null...
>
> this seems like a rather common problem (it should have happend to
> them who is using the HibernateSqueezer) anyone know a solution?
>
>
> --
> /ted
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org