[jboss-user] [JBoss jBPM] - Re: hibernate AnnotationConfiguration rather than Configurat
crussell42
do-not-reply at jboss.com
Sat Feb 3 13:46:45 EST 2007
IT WORKS!
After much head banging and incorrect assumptions I think I have it.
Please developers of jbpm can you look at this seriously as a means of persisting annotated pojos.
In HibernateHelper I added the following code
| import org.hibernate.cfg.AnnotationConfiguration;
| import org.hibernate.cfg.DefaultComponentSafeNamingStrategy;
| .
| .
| public static Configuration createConfiguration(String cfgXmlResource, String propertiesResource) {
| AnnotationConfiguration configuration = new AnnotationConfiguration();
| //NOT SURE WHY BUT configuration not picking up
| //hibernate.cfg.xml
| //<property name="hibernate.ejb.naming_strategy">
| //org.hibernate.cfg.DefaultComponentSafeNamingStrategy</property>
| log.debug("NAMING START STRATEGY ["+configuration.getNamingStrategy().getClass().getName()+"]");
| log.debug(configuration.setNamingStrategy(new DefaultComponentSafeNamingStrategy()));
| log.debug("NAMING AFTER STRATEGY ["+configuration.getNamingStrategy().getClass().getName()+"]");
|
With these changes you can now add mappings to the hibernate.cfg.xml
such as
| <mapping package="foo"/>
| <mapping class="foo.MyAnnotatedFooClass"/>
|
To pick up annotated classes....
Now I also had to put my classes in jbpm-jpdl.jar but I will figure out the class loader issues later.
Net effect: my annotated classes persist where I expect them to.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010471#4010471
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010471
More information about the jboss-user
mailing list