[jboss-jira] [JBoss JIRA] Created: (JBPM-832) persist annotated classes by using AnnotationConfiguration in HibernateHelper.java
Chris Russell (JIRA)
jira-events at jboss.com
Sun Feb 4 10:15:19 EST 2007
persist annotated classes by using AnnotationConfiguration in HibernateHelper.java
----------------------------------------------------------------------------------
Key: JBPM-832
URL: http://jira.jboss.com/jira/browse/JBPM-832
Project: JBoss jBPM
Issue Type: Feature Request
Components: Core Engine
Affects Versions: jBPM 3.2 beta 1
Reporter: Chris Russell
Assigned To: Tom Baeyens
Fix For: jBPM 3.2 beta 2
Should be able to persist annotated Entitys (classes that dont have a hbm.xml mapping file).
To do this is a fairly simple change to HibernateHelper.java.
One unresolved question here is why doesnt the hibernate.cfg.xml configuration option
<property name="hibernate.ejb.naming_strategy">
get picked up??
HibernateHelper.java
..
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....
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list