Java EE 7 SDK |
This sample application demonstrates how to inject a bean annotated with the @Transactional
annotation.
This sample application uses a servlet that injects a bean annotated with the @Transctional
annotation
with one of the user selected values. The servlet provides a web page to select the value for @Transctional
annotation.
When the user selects the value and clicks the Submit button, the servlet injects a bean with the selected value for the
@Transctional
annotation. For example, selecting MANDATORY
injects the following bean:
@Transactional(value = Transactional.TxType.MANDATORY) public class BeanMandatory { ... }
The methods in this bean are invoked inside and outside the transactional context to demonstrate the different behaviour. The result is presented as HTML output.
Perform the following steps to build, deploy, and run the application:
app_dir
is the sample application base directory: samples_install_dir/javaee7/cdi/transactional
.app_dir.
run
outcome.
mvn clean verify cargo:run
clean
outcome to undeploy the sample application and to remove the temporary directories such as build
and dist
.
mvn clean
If you have problems when running the application, refer to the troubleshooting document.
Copyright © 1997-2013 Oracle and/or its affiliates. All rights reserved.