This content has been marked as final.
Show 3 replies
-
1. Re: PVM HibernateLongVariable
frantisek.kocun Feb 27, 2009 4:28 PM (in response to frantisek.kocun)There was a bug in method VariableTypesBinding.parseTypeMapping(). It expected "class" attribute in xml to be set to "persisted" and I chcnged it to "hibernate":
// if type="hibernate" } else if ("hibernate".equals(className)) {
But I think code in HibernateLongIdMatcher is broken as well.if (environment!=null) { SessionFactory sessionFactory = (SessionFactory) environment.get("hibernate.session.factory"); if (sessionFactory!=null) { ClassMetadata classMetadata = sessionFactory.getClassMetadata(value.getClass()); matches = ( (classMetadata!=null) && (classMetadata.getIdentifierType().getClass()==LongType.class) ); }
First you should to ask if value is not a HibernateProxy cos in that case you wont get any metadata (as done in jBPM 3)..Class valueClass = value.getClass(); if (value instanceof HibernateProxy) { valueClass = valueClass.getSuperclass(); }
And second. How can you get SessionFactory from envoronment? The interface has only addContext(Context) method and SessionFactory does not implemenst Context. But maybe I shoul implement my own Environment and fill it in another way than throgh Environment interface. Maybe my bad.
What do you think?
Thanks
Fero -
2. Re: PVM HibernateLongVariable
frantisek.kocun Feb 27, 2009 4:31 PM (in response to frantisek.kocun)BTW wouldn't it be better to use Digester for parsing. It is faster (SAX no DOM), declarative, easy to use and you can do really complicated parsing implementing its interfaces.. And if you want both directions xml2java and java2xml, why not to use Castor? But I don't have big experienced with it. But I think it should be good solution..
Fero -
3. Re: PVM HibernateLongVariable
frantisek.kocun Feb 28, 2009 5:26 AM (in response to frantisek.kocun)"frantisek.kocun@gmail.com" wrote:
And second. How can you get SessionFactory from envoronment? The interface has only addContext(Context) method and SessionFactory does not implemenst Context. But maybe I shoul implement my own Environment and fill it in another way than throgh Environment interface.
I was wrong. I didn't understand how context works. So the PVM code is good and really very useful. I implemented my own HibernateContext and it was easy..
Fero