On 22/09/2017 10:54, Maxim Solodovnik wrote:
Hello,
I'm trying to get rid of entity list in my persistence.xml and to use
springs package autoscan for this.
I have specified following configuration for entity manager factory:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="openmeetings" />
<property name="packagesToScan" value="org.apache.openmeetings.db.entity" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="generateDdl" value="false" />
</bean>
</property>
</bean>
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>
Entities seems to be found BUT named queries not :(
What I'm I doing wrong? Maybe I need to specify some additional
postprocessor to perform additional scan for named queries?
Thanks in advance for your answers :)
OpenJPA version 2.4.2 (latest)
Spring 4.3.10
Hi Maxim,
you can take Syncope configuration [1] as reference: in that branch
(1_2_X) we're using OpenJPA 2.3 and Spring 4.2.9 but it shouldn't matter
much (more recent branches use more recent dependencies, but the
configuration is more involved).
FYI, [1] is included by [2]; properties are at [3].
Ah, we also use [4] and do compile-time entity enhancement [5].
Regards.
[1]
https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/persistenceContextEMFactory.xml
[2]
https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/persistenceContext.xml
[3]
https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/persistence.properties
[4]
https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/META-INF/spring-persistence.xml
[5] https://github.com/apache/syncope/blob/1_2_X/core/pom.xml#L370-L401
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/