[JBoss jBPM] - Re: PVM HibernateLongVariable
by frantisek.kocun@gmail.com
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
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4213874#4213874
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4213874