It seems you are not using @NamedQueries :(
The issue I'm facing: application starts as expected, then fails on first
named query (Named query not found message with stack trace)

I thought maybe it would be possible to perform additional scan for named
queries
Since it works as expected with persistence unit like this: [1]

[1]
https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/main/webapp/WEB-INF/classes/META-INF/mysql_persistence.xml


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

> OK, Thanks for clarifications!
>
> On Fri, Sep 22, 2017 at 7:32 PM, Francesco Chicchiriccò <
> ilgro...@apache.org> wrote:
>
>> On 22/09/2017 14:29, Maxim Solodovnik wrote:
>>
>>> It seems all your entities are listed in
>>> https://github.com/apache/syncope/blob/1_2_X/core/src/main/r
>>> esources/META-INF/orm.xml
>>>
>>
>> No, these are not all entities, but only a few, e.g. the ones for which
>> we want to allow users to customize something without messing with source
>> classes (hence we don't rely on JPA annotations for such entities).
>>
>> There are several JPA entities not listed in orm.xml:
>>
>> https://github.com/apache/syncope/tree/1_2_X/core/src/main/j
>> ava/org/apache/syncope/core/persistence/beans
>>
>> Regards.
>>
>>
>> What I would like to achieve is something like this accepted answer:
>>> https://stackoverflow.com/questions/16088112/how-to-auto-det
>>> ect-entities-in-jpa-2-0
>>>
>>> i.e. auto detect entities using packageToScan property
>>>
>>>
>>> On Fri, Sep 22, 2017 at 7:24 PM, Maxim Solodovnik <solomax...@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ò <
>>>> ilgro...@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.OpenJpaVendorAdapt
>>>>>> er">
>>>>>> <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#L3
>>>>> 70-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

Reply via email to