-
1. Re: De-Persistence problem with Node?
pramero Feb 23, 2007 11:36 AM (in response to pramero)Can someone please help me? I need to be able to cast my TaskNode to a TaskNode so that I can get the Tasks off of it and examine them.
-
2. Re: De-Persistence problem with Node?
estaub Feb 23, 2007 2:59 PM (in response to pramero)I don't have an answer, but I do have a little info.
The CGLIB proxies are used by Hibernate.
See http://forum.hibernate.org/viewtopic.php?t=941095&highlight=&sid=1afdf50d756158fe8298285e49f7df9c and http://www.hibernate.org/hib_docs/reference/en/html/performance.html#performance-proxies (search for "cast")
See also the response in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76181, in case it's relevant.
When/if you figure it out, please post what you know for other folks - it sounds bad!
-Ed Staub -
3. Re: De-Persistence problem with Node?
estaub Feb 23, 2007 3:03 PM (in response to pramero)(This is a repost with the url's fixed.)
I don't have an answer, but I do have a little info.
The CGLIB proxies are used by Hibernate.
See http://forum.hibernate.org/viewtopic.php?t=941095&highlight=&sid=1afdf50d756158fe8298285e49f7df9c
and http://www.hibernate.org/hib_docs/reference/en/html/performance.html#performance-proxies (search for "cast")
See also the response in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76181, in case it's relevant.
When/if you figure it out, please post what you know for other folks - it sounds bad!
-Ed Staub -
4. Re: De-Persistence problem with Node?
symmetrysolutions Feb 23, 2007 5:00 PM (in response to pramero)In the code that you posted, you never declare t2 and you're redeclaring n from a Node to a TaskNode.
-
5. Re: De-Persistence problem with Node?
pramero Feb 23, 2007 6:10 PM (in response to pramero)"symmetrysolutions" wrote:
In the code that you posted, you never declare t2 and you're redeclaring n from a Node to a TaskNode.
Sorry, I was re-writing it a bit (removing some profanity from the variable names) as I posted it, but didn't do a full/acurate job of my renaming.
t2 is the same token as above (tok) and the TaskNode variable should be "tn" or whatever unique name.
The point is, if you call getNode() on token, and try to cast it to a TaskNode, you get a class cast exception. -
6. Re: De-Persistence problem with Node?
pramero Feb 23, 2007 6:19 PM (in response to pramero)"estaub" wrote:
I don't have an answer, but I do have a little info.
The CGLIB proxies are used by Hibernate.
http://www.hibernate.org/hib_docs/reference/en/html/performance.html#performance-proxies
Ah, this makes perfect sense. I was fully (ok, not fully) aware of Hibernate's us of proxies created by CGLIB. I was unaware of this quirk though. Looking back through all my personal use of hibernate, by public API's are always defined as interfaces, so sub-classes are actually sub-interfaces, and are therefore always castable (because the proxies can implement all interfaces) -- so I've never ran into this particular problem, although I've used Hibernate with polymorphism quite a lot.
It seems the only real fix is for jBPM to re-design their public interfaces such that they are actually interfaces. Hence TaskNode would implement Node and not extend Node.
This leaves me in an interesting quandy: no way to examine the Tasks of my process definition's TaskNodes. -
7. Re: De-Persistence problem with Node?
olivier_debels Feb 26, 2007 3:44 AM (in response to pramero)Hi,
Hibernate proxies are not aware of the original class hierarchy, but you can get your real object back of course.
See: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97094&view=previous
and http://www.jboss.com/index.html?module=bb&op=viewtopic&t=94900
Hope this helps,
Olivier.