[jboss-user] [JBoss jBPM] - hibernate AnnotationConfiguration rather than Configuration
crussell42
do-not-reply at jboss.com
Thu Feb 1 10:30:35 EST 2007
I am trying to persist an annotated @Entity object but I do not have a mapping resource foo.hbm.xml.
If HibernateHelper.java returned an AnnotationConfiguration rather than
a Configuration It would seem I could then specify a property in hibernate.cfg.xml such as
| <mapping package="foo"/>
| <mapping class="foo.MyAnnotatedFooClass"/>
|
Which then would allow my annotated class to be stored using a HibernateLongInstance
rather than as a blob (since my annotated class is Serializable)
So Then I put this at the top of jbpm.varmapping.xml (which I havent seen as example but seems to work...except for the resulting exception).
| <jbpm-type>
| <matcher>
| <bean class="org.jbpm.context.exe.matcher.ClassNameMatcher">
| <field name="className"><string value="foo.MyAnnotatedFooClass" /></field>
| </bean>
| </matcher>
| <variable-instance class="org.jbpm.context.exe.variableinstance.HibernateLongInstance" />
| </jbpm-type>
|
>From hibernate docs
anonymous wrote :
| Interesting here is the use of AnnotationConfiguration. The packages and annotated classes are declared in your regular XML configuration file (usually hibernate.cfg.xml).
| Note that you can mix the hbm.xml use and the new annotation one.
| The resource element can be either an hbm file or an EJB3 XML deployment descriptor. The distinction is transparent for your configuration process.
|
Exception received when I try this strategy
| javax.ejb.EJBException: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping package="foo.MyAnnotatedFooClass"/>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009479#4009479
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009479
More information about the jboss-user
mailing list