[
http://jira.jboss.com/jira/browse/JBPM-832?page=all ]
Tom Baeyens closed JBPM-832.
----------------------------
Fix Version/s: (was: jBPM jPDL 3.2.2)
Resolution: Rejected
I don't want to inrtoduce a dependency on the annotation configuration.
You can inject a custom made configuration in the persistence service factory like this:
Configuration configuration = new AnnotationConfiguration();
configuration.configure(); // reads hibernate.cfg.xml
PersistenceServiceFactory psf =
JbpmConfiguration.getInstance().getServiceFactory(Services.SERVICENAME_PERSISTENCE);
psf.setConfiguration(configuration);
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 jPDL 3.2 beta 1
Reporter: Chris Russell
Assigned To: Tom Baeyens
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