Hi Bengt,

I think you're right that email is a better medium for this conversation.

ARIES-322 is still open, but I have queried why. The fix was committed back in 
June, and the failure has not been brought up since so I'm pretty certain 
someone has just forgotten to close off the JIRA.

The solution does not require an anonymous bean, it just seemed a little more 
elegant as it limits access to the uninitialized bean.

The reason this solution works is because we inject the bean that needs 
transactional initialisation into another, and have that bean call initialize. 
Because the fixture bean has been completely instantiated and wrappered before 
it is injected, we can call methods on the injected bean and get the relevant 
transactional behaviour.

We then need a way to access the injected bean, which is why I used an instance 
factory method. This isn't strictly necessary, but otherwise you need to be 
sure that you create the initializing bean before you first use the fixture, or 
else it will not have been initialized.

I hope this clears things up a bit.

Regards,

Tim

----------------------------------------
> Date: Tue, 21 Sep 2010 11:07:32 -0400
> From: [email protected]
> To: [email protected]
> Subject: [jira] Commented: (ARIES-413) Injecting an entity manager using 
> factory method
>
>
> [ 
> https://issues.apache.org/jira/browse/ARIES-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913019#action_12913019
>  ]
>
> Bengt Rodehav commented on ARIES-413:
> -------------------------------------
>
> Can you elaborate a little why this would work? Why does it require an 
> anonymous? Also noted that ARIES-322 is still open.
>
> Maybe we should continue this conversation on the list instead of in JIRA...
>
>> 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):
>> 
>> 
>> 
>> 
>> 
>
> --
> 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