openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Solodovnik <solomax...@gmail.com>
Subject Re: OpenJPA and entities auto-scan
Date Fri, 22 Sep 2017 12:29:19 GMT
It seems all your entities are listed in
https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/META-INF/orm.xml

What I would like to achieve is something like this accepted answer:
https://stackoverflow.com/questions/16088112/how-to-auto-detect-entities-in-jpa-2-0

i.e. auto detect entities using packageToScan property


On Fri, Sep 22, 2017 at 7:24 PM, Maxim Solodovnik <solomax666@gmail.com>
wrote:

> Thanks a lot Francesco!
> Will give it a try and report back!
>
> On Fri, Sep 22, 2017 at 7:23 PM, Francesco Chicchiriccò <
> ilgrosso@apache.org> wrote:
>
>> 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.LocalContainerEntityManag
>>> erFactoryBean">
>>> <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.PersistenceAnnota
>>> tionBeanPostProcessor"
>>> />
>>>
>>> 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/r
>> esources/persistenceContextEMFactory.xml
>> [2] https://github.com/apache/syncope/blob/1_2_X/core/src/main/r
>> esources/persistenceContext.xml
>> [3] https://github.com/apache/syncope/blob/1_2_X/core/src/main/r
>> esources/persistence.properties
>> [4] https://github.com/apache/syncope/blob/1_2_X/core/src/main/r
>> esources/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/
>>
>>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message