[ 
https://issues.apache.org/jira/browse/ARIES-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15243100#comment-15243100
 ] 

Jurriaan Heuberger commented on ARIES-1533:
-------------------------------------------

We have rich domain model classes which internally use entity classes. Some of 
the methods of this model are transactional.

In order to activate the transaction interceptor, we are creating prototype 
scoped beans, and instantiating them using the 
container.getComponentInstance(). The dependencies of the model classes are 
hidden within a factory. We prefer the factory returns the interface classes 
instead of the concrete implementation classes. 

<bean id="factory" class="com.example.ProtoFactory" >
    <argument ref="dependency1" />
    <argument ref="dependency2" />
</bean>
<bean id="objProto" class="com.example.interfaces.RichDomainObject" 
factory-ref="factory" factory-method="createObject" scope="prototype" />

This all is not related to the injection of the entitymanager in any way, but 
the NPE prevents the bundle from loading.

> JPA blueprint AnnotationScanner is unable to handle Interfaces
> --------------------------------------------------------------
>
>                 Key: ARIES-1533
>                 URL: https://issues.apache.org/jira/browse/ARIES-1533
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: jpa-2.3.0
>            Reporter: Jurriaan Heuberger
>
> If there are beans defined in the blueprint with a "class" attribute 
> referencing an interface instead of a class, the JPA blueprint 
> AnnotationScanner fails with a NullPointerException.
> During the annotation scanning, the assumption is made that the class 
> hierarchy will eventually hit the Object.class, while an interface Class<?> 
> will return null when the getSuperclass() is called.
> While it may not be a common use case to reference an Interface in a bean 
> definition, I have a rather specific use case where I am using a factory 
> class with a factory method to return an implementation of an interface.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to