different transaction types depending on the kind of interface

"Gunnar Schrader" <[email protected]> Tue, 1 May 2007 11:16:52 +0200
Newsgroups gmane.comp.java.xdoclet.user
Message-ID <[email protected]>
Hi,

I want to have a method in in the remote and home interface of an EJB,
and this method should have different transaction types depending on
the interface type.
What I want is something like this.

   /**
    *
    * @ejb.interface-method view-type="local"
    * @ejb.transaction type="Supports"
    *
    * @ejb.interface-method view-type="remote"
    * @ejb.transaction type="RequiresNew"
    *
    */
public IFooObject foo () {}

So the resulting ejb-jar.xml should look like this:

	<assembly-descriptor>
		<container-transaction>
			<method>
				<ejb-name>UseCaseEJB</ejb-name>
				<method-intf>Remote</method-intf>
				<method-name>foo</method-name>
				<method-params>
<method-param>Long</method-param>
				</method-params>
			</method>
			<trans-attribute>Supports</trans-attribute>
		</container-transaction>
		<container-transaction>
			<method>
				<ejb-name>UseCaseEJB</ejb-name>
				<method-intf>Local</method-intf>
				<method-name>newTest</method-name>
				<method-params>
					<method-param>Long</method-param>
				</method-params>
			</method>
			<trans-attribute>RequiresNew</trans-attribute>
		</container-transaction>
	</assembly-descriptor>


But this will not work because @ejb.interface-method is only allowed
once per method.
So the following would be possible:

   /**
    *
    * @ejb.interface-method view-type="both"
    * @ejb.transaction type="RequiresNew"
    *
    */
public IFooObject foo () {}
But now I can't give different transaction types depending on the interfaces?


How can I solve my problem without renaming the method etc. ?

Regards,

guschra

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/