|
Page Created :
OPENEJB :
Annotations, Defaults and XML
Annotations, Defaults and XML has been created by David Blevins (Sep 28, 2007). Content:
@Stateless or @Stateful on a class replaces the descriptor tags <session>, <ejb-name>, <session-type>Stateless</session-type>, and <session-type>Stateful</session-type>. @RemoteHome or @LocalHome is used on a class to replace <home> or <local-home>. We inspect the actual home or local-home interface to determine the related <remote> or <local> interface. @TransactionManagement on a class replaces <transaction-type> @TransactionAttribute on a class and/or method replaces <container-transaction>. You'll need one @TransactionAttribute for each <container-transaction>/<method> xml element. A <method-name>*</method-name> would turn into an @TransactionAttribute on a class, everything else would go on methods. @EJB used on a class replaces <ejb-ref> and <ejb-local-ref>. @EJB used on a field or setter method (private or public) request injection of that EJB as well. When @EJB is used on a class the "beanInterface" attribute is required. When used on a field or setter method, the "beanInterface" attribute defaults to the type of the field or setter method. @Resource used on a class replaces <env-entry>, <resource-ref>, <resource-env-ref>. @Resource used on a field or method (private or public) requests injection of that resource. When @Resource is used on a class, the "type" attribute is required. When used on a field or method, the "type" attribute defaults to the type of the field or setter method. There are more annotations obviously, but these are fairly simple and get rid of a ton of xml. |
Unsubscribe or edit your notifications preferences
