You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Timothy Ward (JIRA)" <ji...@apache.org> on 2010/09/20 18:13:32 UTC
[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=12912558#action_12912558 ]
Timothy Ward commented on ARIES-413:
------------------------------------
As the existing JPA blueprint schema has been released twice, I think this change will need to go in version 1.1 of the schema.
I am going to make the property attribute of <unit/> and <context/> optional, and add a new attribute index.
-----------------------------------------------------------------------------
I propose the following usage for both unit and context:
To inject into a property "foo" : <unit property="foo" unitname="bar"/>
To inject as an un-indexed constructor argument: <unit unitname="bar"/>
To inject as an indexed constructor argument at position 2: <unit index="2" unitname="bar"/>
-------------------------------------------------------------------------------
The following will generate exceptions when parsing:
<unit property="foo" index="1" unitname="bar"/> - it is invalid to specify a property attribute and an index attribute
<unit index="abc" unitname="bar"/> - it is invalid to specify an index attribute that is not parseable as an int
-------------------------------------------------------------------------------
What do people think of this proposed change? It allows for complete replacement of the <argument> element (as per the original use case) in a single element (rather than having to nest it). This approach is also backward compatible with the existing schema, and has an identical usage pattern for both property and constructor injection.
> 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.
Re: [jira] Commented: (ARIES-413) Injecting an entity manager using factory method
Posted by Alasdair Nottingham <no...@apache.org>.
Hi,
+1
Alasdair Nottingham
On 20 Sep 2010, at 09:13, "Timothy Ward (JIRA)" <ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/ARIES-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912558#action_12912558 ]
>
> Timothy Ward commented on ARIES-413:
> ------------------------------------
>
> As the existing JPA blueprint schema has been released twice, I think this change will need to go in version 1.1 of the schema.
>
> I am going to make the property attribute of <unit/> and <context/> optional, and add a new attribute index.
>
> -----------------------------------------------------------------------------
>
> I propose the following usage for both unit and context:
>
> To inject into a property "foo" : <unit property="foo" unitname="bar"/>
>
> To inject as an un-indexed constructor argument: <unit unitname="bar"/>
>
> To inject as an indexed constructor argument at position 2: <unit index="2" unitname="bar"/>
>
> -------------------------------------------------------------------------------
>
> The following will generate exceptions when parsing:
>
> <unit property="foo" index="1" unitname="bar"/> - it is invalid to specify a property attribute and an index attribute
>
> <unit index="abc" unitname="bar"/> - it is invalid to specify an index attribute that is not parseable as an int
>
> -------------------------------------------------------------------------------
>
> What do people think of this proposed change? It allows for complete replacement of the <argument> element (as per the original use case) in a single element (rather than having to nest it). This approach is also backward compatible with the existing schema, and has an identical usage pattern for both property and constructor injection.
>
>> 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.
>