[
https://issues.apache.org/jira/browse/ARIES-1341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610781#comment-14610781
]
Michał Woś commented on ARIES-1341:
-----------------------------------
OK. I found out where the problem lies. Karaf has two features named
persistence-api (version 2.0.0 and 2.1.0). First depends on genorimo specs
(javax.persistence;version=1.1). Second depends on hibernate api
(javax.persistence;version=2.1.0). According to features.xml of karaf jpa
feature can work with both persistence-api 's (<feature version="[2.0.0,2.2.0)"
prerequisite="false" dependency="false">persistence-api</feature>). That means
aries jpa wires with latest package of javax.persistence whereas anything that
is dependant on geronimo specs wires with 1.1 version. That actually caused
getAnnotation() and reflection issues. I had same classes loaded twice because
I had wirings to same package in 2 different versions. Aries wired to latest
(2.1.0), my bundle wired to 1.1.
Sorry for wasting your time on that but it really looked like aries issue. Now
it seems rather to karaf issue as it permits to have same package in 2
different versions.
This means this issue is an improvement. What should be done is:
* only top level class is scanned. super classes are not
* adding support to annotate classes and methods
* scanning shouldn't stop when first field/method is found. we can have
multiple persistence units in one class
As for the transaction annotation, I had a solution written myself so far but I
saw an example using <tx:enable-annotations />. I will give it a try.
> JpaBeanProcessor not working in karaf
> -------------------------------------
>
> Key: ARIES-1341
> URL: https://issues.apache.org/jira/browse/ARIES-1341
> Project: Aries
> Issue Type: Improvement
> Components: Blueprint, JPA
> Affects Versions: jpa-2.0.0
> Environment: karaf-4.0.0, java 8
> Reporter: Michał Woś
> Assignee: Christian Schneider
> Fix For: jpa-2.1.0, jpa-2.0.1
>
>
> * getAnnotation() return null because annotations are proxied (com.sun.proxy).
> * only top level class is scanned. super classes are not
> * only fields are scanned whereas target of persistence annotations is: TYPE,
> METHOD, FIELD
> * Setting persistence fields results in:
> Can not set javax.persistence.EntityManager field xxx to
> com.sun.proxy.$Proxy37
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)