spring+hibernate+jbpm整合成功

最后的配置结果是:

 

 

hibernate.cfg.xml、jbpm.cfg.xml在关联spring后保持不变,只需要更改spirng的配置文件就好了。


<? xml version="1.0" encoding="UTF-8" ?>
<! DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd"
>

< beans >
    
< bean  id ="dataSource"  class ="org.springframework.jdbc.datasource.DriverManagerDataSource" >
        
< property  name ="driverClassName" >
            
< value > com.mysql.jdbc.Driver </ value >
        
</ property >
        
< property  name ="url" >

 


            
< value > jdbc:mysql://localhost:3306/test </ value >
        
</ property >
        
< property  name ="username" >
            
< value > root </ value >

        
</ property >
        
< property  name ="password" >
            
< value />

 


        
</ property >
    
</ bean >
    
<!--  Hibernate SessionFactory  -->

 


    
< bean  id ="sessionFactory"  class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
        
< property  name ="dataSource" >
            
< ref  local ="dataSource" />
        
</ property >
        
< property  name ="mappingLocations" >   
           
< value > classpath*:/org/jbpm/**/*.hbm.xml </ value >   
           
</ property >
        
< property  name ="hibernateProperties" >   
           
< props >   
               
< prop  key ="hibernate.dialect" > org.hibernate.dialect.MySQLDialect </ prop >
               
< prop  key ="hibernate.hbm2ddl.auto" > update </ prop >
               
< prop  key ="hibernate.jdbc.batch_size" > 0 </ prop >

 


           
</ props >
       
</ property >  
    
</ bean >
    
<!--  Transaction manager for a single Hibernate SessionFactory (alternative to JTA)  -->
    
< bean  id ="transactionManager"  class ="org.springframework.orm.hibernate3.HibernateTransactionManager" >
        
< property  name ="sessionFactory" >
            
< ref  local ="sessionFactory" />
        
</ property >
    
</ bean >
    
    
<!--  reading jBPM process definitions  -->
    
< bean  id ="websaleWorkflow1"  class ="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean" >
        
< property  name ="definitionLocation"     value ="processdefinition.xml" />
    
</ bean >
    
<!--  jBPM configuration -->  
    
< bean  id ="jbpmConfiguration"  class ="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean" >

        
< property  name ="sessionFactory"  ref ="sessionFactory" />
        
< property  name ="configuration"  value ="jbpm.cfg.xml" />
        
< property  name ="processDefinitions" >
            
< list >
                
< ref  local ="websaleWorkflow1" />
            
</ list >
        
</ property >
        
< property  name ="createSchema"  value ="true" />
    
</ bean >
    
<!--  jBPM template  -->
    
< bean  id ="jbpmTemplate"  class ="org.springmodules.workflow.jbpm31.JbpmTemplate" >
        
< constructor-arg  index ="0"  ref ="jbpmConfiguration" />
        
< constructor-arg  index ="1"  ref ="websaleWorkflow1" />
    
</ bean >

</ beans >

 

 

其中

< property  name ="mappingLocations" >   
           
< value > classpath*:/org/jbpm/**/*.hbm.xml </ value >   

 


           
</ property >

很关键,我就是想spring会通过jbpm找到hibernate.cfg.xml而没有设置,才失败的。

 

你可能感兴趣的:(spring,Hibernate,bean,jbpm,Class,encoding)