2013-06-15 11 views
6
<?xml version="1.0" encoding="UTF-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:jee="http://www.springframework.org/schema/jee" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/util 
      http://www.springframework.org/schema/util/spring-util-3.0.xsd 
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context.xsd 
      http://www.springframework.org/schema/jee 
      http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> 

     <util:properties id="hibernateProperties" location="classpath:hibernate.properties" /> 

     <bean id="usermanagementSessionFactory" 
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
      <property name="dataSource" ref="usermanagementDataSource" /> 
      <property name="configLocation" value="classpath:hibernate.cfg.xml" /> 
      <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> 
      <property name="hibernateProperties" ref="hibernateProperties" /> 
     </bean> 

     <jee:jndi-lookup id="usermanagementDataSource" jndi-name="java:jboss/datasources/usermanagementDS" /> 

     <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 
      init-method="init" destroy-method="close"> 
      <property name="forceShutdown" value="false" /> 
      <property name ="startupTransactionService" value="true"/> 
     </bean> 

     <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> 
      <property name="transactionTimeout" value="30" /> 
     </bean> 

     <bean id="transactionManager" 
      class="org.springframework.transaction.jta.JtaTransactionManager"> 
      <property name="transactionManager" ref="atomikosTransactionManager" /> 
      <property name="userTransaction" ref="atomikosUserTransaction" /> 
     </bean> 

     <bean id="User" class="com.ecom.data.access.model.User"/> 
     <bean id="myFactory" class="com.ecom.data.access.dao.MyFactory"/> 

    </beans> 

Sto usando hibernate 4 molla 3 Maven 3, ho questo file configuratiobn e qui sto usando fabbrica sessione locale e compila correttamente ma dà l'errore quando sto usando la Il server JBoss per la distribuzione, quindi la console del server dà l'errore 'configurationClass' non è scrivibile o ha un metodo setter non valido. Il tipo di parametro del setter corrisponde al tipo di ritorno del getter? per favore mi aiuti a risolvere questo problemala proprietà 'configurationClass' non è scrivibile o ha un metodo setter non valido. Fa il tipo di parametro del palleggiatore

+0

Quale versione di JBoss come avete? –

+0

@ Pavel Horal sto usando jBoss7 per favore suggeriscimi qualsiasi soluzione per questo –

risposta

13

La tua definizione di fagioli suggerisce che si sta tentando di configurare Hibernate 3, non Hibernate 4. Probabilmente avete seguito l'esempio errato o tutorial. In Hibernate 4 non è presente la proprietà configurationClass. Basta rimuoverlo:

<bean id="usermanagementSessionFactory" 
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
    <property name="dataSource" ref="usermanagementDataSource" /> 
    <property name="configLocation" value="classpath:hibernate.cfg.xml" /> 
    <property name="hibernateProperties" ref="hibernateProperties" /> 
</bean> 

Con Hibernate 4, non è inoltre necessario fornire XML di configurazione. Tutto quello che puoi fare è specificare i pacchetti da sottoporre a scansione per @Entity classi:

<property name="packagesToScan" value="com.ecom.data.access.model" /> 
Problemi correlati