IllegalArgumentException when using @Proxy and trying to delete a loaded but proxied class

Description

I'm receiving an IllegalArgumentException while trying to delete an entity that is a part of a @ContainedIn/@IndexedEmbedded relationship. I created a testcase to reproduce the error i'm seeing. The original issue that prompted this was actually a ClassCastException as discussed in this thread

https://forum.hibernate.org/viewtopic.php?f=9&t=1006381

however in creating the test case i was unable to replicate that particular error, but ran into this one, which seemed similar.

Attachments

1

Activity

Show:

Emmanuel Bernard October 13, 2010 at 3:42 PM

I've spend some time on the issue. The problem is that we enlist the required Method (getter in this case) from the actual physical class and not from the @Proxy.proxyClass. When an instance was initially lazy and subsequently loaded, the actually type is HibernateProxy_Javassistxyz and not the actual physical class (say Person).

When trying to access the getter, the invoke operation fails.

The solution is not trivial and would involve finding the referencing getter from the @Proxy.proxyClass class and use this one (exclusively or as a backup?). That's a lot of work though for a very edge case.

I don't really have the necessary cycles to work on it but if someone from the community can step up and provide a solution, I will try and assist.

The unit test is committed and available here http://github.com/emmanuelbernard/hibernate-search/commit/3d6b1243729b139c0659eddee4cf53a9a4126c4d
The work has to be done in AbstractDocumentBuilder

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created August 18, 2010 at 5:04 AM
Updated September 11, 2011 at 6:19 PM
Resolved December 8, 2010 at 11:58 AM