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

Timothy Ward commented on ARIES-413:
------------------------------------

Hi Bengt,

The current solution will work with any construction mechanism (factory or 
otherwise) because they all use the <argument> syntax.

As for your initialisation question. Qualities of service, such as transations, 
can only be applied by the blueprint contianer when the thread of invocation 
crosses a boundary between beans as this is the point at which we can detect 
the program flow and start the transaction. Making an internal bean invocation 
doesn't breach the bean boundary and so we can't apply any transaction 
semantics. If you want to get the transaction behaviour you're after you will 
need to invoke the method from another bean.

Using a factory method to try and get around this won't work either, as you 
still don't have access to the managed bean instance yet. The instance you have 
is a raw POJO, and doesn't contain any of the wrapper layers or inteception 
logic. The only time you can call the initialise method and get a transaction 
started is to be injected with the bean instance, or to get the bean instance 
from the BlueprintContainer service.

There is no ordering between the transaction tag and the context tag in your 
example, they are entirely independent.

> Injecting an entity manager using factory method
> ------------------------------------------------
>
>                 Key: ARIES-413
>                 URL: https://issues.apache.org/jira/browse/ARIES-413
>             Project: Aries
>          Issue Type: Improvement
>          Components: JPA
>    Affects Versions: 0.2
>            Reporter: Bengt Rodehav
>            Assignee: Timothy Ward
>
> It is only possible to use setter injection when injecting a JPA entity 
> manager. The following  injection types should also be supported since they 
> are supported in the Blueprint spec:
> - Constructor injection
> - Factory method injection
> - Factory class injection
> An example of usage could be (using a factory method):
> <bean id="beanImpl" class="MyClass" factory-method="create">
>   <argument>
>     <jpa:context property="entityManager" unitname="myPU"/>
>   </argument>
> </bean>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to