|
From: Magnus H. <mh...@gm...> - 2007-06-07 07:31:43
|
Hi.
Has something changes recently that cause injection of implementation
specific entitymanagers using PersistenceAnnotationBeanPostProcessor to
fail?
This used to work in 2.0.4 afaik. Then we started a migration to Oracle
Toplink 11g preview, upgrades spring, and started getting these errors. I
thoght it was connected to toplink, removed
PersistenceAnnotationBeanPostProcessor and used normal setter injection.
But now I'm back in the hibernate branch, upgrade spring to 2.1-m2 and got
these errors once again...
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'processAssembler' defined in file [C:\Data\agtr\jboss-
4.0.5.GA\server\default\.\tmp\deploy\tmp56715fr-app-exp.war\WEB-INF\classes\META-INF\spring-config\fr\assembler.xml]:
Cannot resolve reference to bean 'processRepository' while setting
bean
property 'processRepository'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'processRepository' defined in file [C:\Data\agtr\jboss-
4.0.5.GA\server\default\.\tmp\deploy\tmp56715fr-app-exp.war\WEB-INF\classes\META-INF\spring-config\fr\dataAccess.xml]:
Initialization of bean failed; nested exception is
java.lang.IllegalStateException: Specified resource type [
javax.persistence.EntityManager] is not assignable to method parameter type
[interface org.hibernate.ejb.HibernateEntityManager]
processRepository contains:
private HibernateEntityManager entityManager;
@Override
protected HibernateEntityManager getEntityManager() {
return this.entityManager;
}
@Override
@PersistenceContext
public void setEntityManager(HibernateEntityManager entityManager) {
this.entityManager = entityManager;
}
Spring config:
<bean id="persistenceUnitManager" class="
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager ">
<property name="persistenceXmlLocations">
<list>
<value>classpath:META-INF/persistence.xml</value>
</list>
</property>
<property name="defaultDataSource" ref="dataSource"/>
</bean>
<bean id="entityManagerFactory"
class="
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager"
ref="persistenceUnitManager"/>
<property name="jpaVendorAdapter">
<bean
class="
org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="ORACLE"/>
<property name="generateDdl" value="false"/>
<property name="showSql" value="true"/>
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">
se.lantmateriet.hibernate.dialect.OracleSpatialDialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
</props>
</property>
</bean>
<bean id="entityManager" class="
org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="processRepository" class="
se.lantmateriet.elips.poc.fr.persistence.HibernateJpaProcessRepository"/>
<bean
class="
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
--
/Magnus Heino
|