Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method parameters

 
Venkatesh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
Would listing <method-param> one below the other map to the listing of paramaters in the method.???
Say We need have two overloaded methods in a bean called:
getID(String name,Integer ID) and
getID(Integer ID,String name)
How should i declare the in the DD if I need different trans-attribute for each of them.Any comments are appreciated!!!
Thanks
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the <method-param> elements are provided in the same order as the Java method parameter declarations. If different methods need different transaction handling, put similarly-handled methods in their own container-transaction block, and differently-handled ones in different container-transaction blocks.
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>MyEJB</ejb-name>
<method-name>getID</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MyEJB</ejb-name>
<method-name>getID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Mandatory</trans-attribute>
</container-transaction>
</assembly-descriptor>
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<method>
<ejb-name>SomeEJB</ejb-name>
<method-name>getID</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>SomeEJB</ejb-name>
<method-name>getID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
 
Venkatesh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Guys :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic