You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2015/11/01 20:15:43 UTC

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 
> <pa...@mapshed.com.au> 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 
>>>> <pa...@mapshed.com.au> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org