Re: javassist/hibernate enhanced class problem
thanks thiago, i'll look into that solution if i find i run into this again On 30/10/2015 10:39 PM, Thiago H de Paula Figueiredo wrote: On Thu, 29 Oct 2015 20:40:29 -0200, Paul Stanton wrote: further, it is not the 'save' that javassistifies the object, it is 'session.load' ! so if you do a session.load(id) and a criteria.list() which returns the same entity, the list will contain a javassisted version of the object, which doesn't play nice with tapestry.grid. using 'get' instead of 'load' seems to avoid this. Good catch. I've always used Session.get() instead of Session.load(). I do remember having a similar problem in the past. I recall fixing it by getting the entity superclass (the original unchanged entity class) and then using GridDataSource to create a BeanModel to pass to the model parameter of Grid. You could even decorate or advice GridDataSource for doing this automatically every time you see a class which looks like something generated by Hibernate with Javassist. Your class name was com.example.MyEntity_$$_jvst648_1, so I'd check whether the class name has "_$$_ on it. On 30/10/2015 9:13 AM, Paul Stanton wrote: Hi Thiago, Using 'merge' instead of 'save' does not resolve the issue. I still have to evict. On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote: On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. How are you saving the object in first place? The most recommended way is using object = session.merge(object), not session.save(object). - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: javassist/hibernate enhanced class problem
On Thu, 29 Oct 2015 20:40:29 -0200, Paul Stanton wrote: further, it is not the 'save' that javassistifies the object, it is 'session.load' ! so if you do a session.load(id) and a criteria.list() which returns the same entity, the list will contain a javassisted version of the object, which doesn't play nice with tapestry.grid. using 'get' instead of 'load' seems to avoid this. Good catch. I've always used Session.get() instead of Session.load(). I do remember having a similar problem in the past. I recall fixing it by getting the entity superclass (the original unchanged entity class) and then using GridDataSource to create a BeanModel to pass to the model parameter of Grid. You could even decorate or advice GridDataSource for doing this automatically every time you see a class which looks like something generated by Hibernate with Javassist. Your class name was com.example.MyEntity_$$_jvst648_1, so I'd check whether the class name has "_$$_ on it. On 30/10/2015 9:13 AM, Paul Stanton wrote: Hi Thiago, Using 'merge' instead of 'save' does not resolve the issue. I still have to evict. On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote: On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. How are you saving the object in first place? The most recommended way is using object = session.merge(object), not session.save(object). - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: javassist/hibernate enhanced class problem
Mabet use an interface for the objects? Then the implementation class can change all it wants to. On Thu, Oct 29, 2015 at 11:40 PM, Paul Stanton wrote: > further, it is not the 'save' that javassistifies the object, it is > 'session.load' ! so if you do a session.load(id) and a criteria.list() > which returns the same entity, the list will contain a javassisted version > of the object, which doesn't play nice with tapestry.grid. using 'get' > instead of 'load' seems to avoid this. > > > On 30/10/2015 9:13 AM, Paul Stanton wrote: > >> Hi Thiago, >> >> Using 'merge' instead of 'save' does not resolve the issue. I still have >> to evict. >> >> On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote: >> >>> On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton >>> wrote: >>> >>> I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. >>> >>> How are you saving the object in first place? The most recommended way >>> is using object = session.merge(object), not session.save(object). >>> >>> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: javassist/hibernate enhanced class problem
further, it is not the 'save' that javassistifies the object, it is 'session.load' ! so if you do a session.load(id) and a criteria.list() which returns the same entity, the list will contain a javassisted version of the object, which doesn't play nice with tapestry.grid. using 'get' instead of 'load' seems to avoid this. On 30/10/2015 9:13 AM, Paul Stanton wrote: Hi Thiago, Using 'merge' instead of 'save' does not resolve the issue. I still have to evict. On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote: On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. How are you saving the object in first place? The most recommended way is using object = session.merge(object), not session.save(object). - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: javassist/hibernate enhanced class problem
Hi Thiago, Using 'merge' instead of 'save' does not resolve the issue. I still have to evict. On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote: On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. How are you saving the object in first place? The most recommended way is using object = session.merge(object), not session.save(object). - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: javassist/hibernate enhanced class problem
On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. How are you saving the object in first place? The most recommended way is using object = session.merge(object), not session.save(object). -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: javassist/hibernate enhanced class problem
Yes, it is necessary to 'evict' after 'save' to avoid this problem. I'm not sure that this is ideal since it increases db io and code but it works. On 29/10/2015 8:23 PM, Paul Stanton wrote: I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. Caused by: java.lang.RuntimeException: Unable to read class file for com.example.MyEntity_$$_jvst648_1.getId() (to gather line number information). at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.constructMemberLocation(PlasticProxyFactoryImpl.java:231) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.getMemberLocation(PlasticProxyFactoryImpl.java:215) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.getMethodLocation(PlasticProxyFactoryImpl.java:165) ~[beanmodel-5.4-beta-35.jar:na] at $PlasticProxyFactory_74fa1a52dc8d.getMethodLocation(Unknown Source) ~[na:na] at $PlasticProxyFactory_74fa1a52dc8c.getMethodLocation(Unknown Source) ~[na:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.orderProperties(BeanModelSourceImpl.java:95) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.create(BeanModelSourceImpl.java:202) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.createDisplayModel(BeanModelSourceImpl.java:145) ~[beanmodel-5.4-beta-35.jar:na] at $BeanModelSource_74fa1a52dcc7.createDisplayModel(Unknown Source) ~[na:na] at org.apache.tapestry5.corelib.components.Grid$1.get(Grid.java:419) ~[tapestry-core-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263) ~[tapestry-core-5.4-beta-35.jar:na] ... 95 common frames omitted - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org . - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
javassist/hibernate enhanced class problem
I have found an issue I believe with tapestery (grid component in this case) where it cannot inspect details of hibernate 'enhanced' objects. This happens when I save an object to the database and then query it out again - the instance is returned from cache as a botched/modified javassist version. I believe I can 'evict' between the save and the query, or close/open a new session to avoid this. Will report back. Caused by: java.lang.RuntimeException: Unable to read class file for com.example.MyEntity_$$_jvst648_1.getId() (to gather line number information). at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.constructMemberLocation(PlasticProxyFactoryImpl.java:231) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.getMemberLocation(PlasticProxyFactoryImpl.java:215) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.getMethodLocation(PlasticProxyFactoryImpl.java:165) ~[beanmodel-5.4-beta-35.jar:na] at $PlasticProxyFactory_74fa1a52dc8d.getMethodLocation(Unknown Source) ~[na:na] at $PlasticProxyFactory_74fa1a52dc8c.getMethodLocation(Unknown Source) ~[na:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.orderProperties(BeanModelSourceImpl.java:95) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.create(BeanModelSourceImpl.java:202) ~[beanmodel-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.services.BeanModelSourceImpl.createDisplayModel(BeanModelSourceImpl.java:145) ~[beanmodel-5.4-beta-35.jar:na] at $BeanModelSource_74fa1a52dcc7.createDisplayModel(Unknown Source) ~[na:na] at org.apache.tapestry5.corelib.components.Grid$1.get(Grid.java:419) ~[tapestry-core-5.4-beta-35.jar:na] at org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263) ~[tapestry-core-5.4-beta-35.jar:na] ... 95 common frames omitted - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org