Here's the Interceptors 1.1 session:
Here's the JPA 2.1 session:
@Stateless public class MyFirstEjbBean implements MyFirstEjb { @EJB private MySecondEjb other; public void firstEjb(){ other.secondEjb(); } } @Stateless public class MySecondEjbBean implements MySecondEjb { public void secondEjb(){ } }
Type | Description |
---|---|
@PrePersist | Executed before the entity manager persist operation is actually executed or cascaded. This call is synchronous with the persist operation. |
@PreRemove | Executed before the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation. |
@PostPersist | Executed after the entity manager persist operation is actually executed or cascaded. This call is invoked after the database INSERT is executed. |
@PostRemove | Executed after the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation. |
@PreUpdate | Executed before the database UPDATE operation. |
@PostUpdate | Executed after the database UPDATE operation. |
@PostLoad | Executed after an entity has been loaded into the current persistence context or an entity has been refreshed. |
@Entity @EntityListeners(class=Audit.class) public class Cat { @Id private Integer id; private String name; private Calendar dateOfBirth; @Transient private int age; private Date lastUpdate; //getters and setters /** * Set my transient property at load time based on a calculation, * note that a native Hibernate formula mapping is better for this purpose. */ @PostLoad public void calculateAge() { Calendar birth = new GregorianCalendar(); birth.setTime(dateOfBirth); Calendar now = new GregorianCalendar(); now.setTime( new Date() ); int adjust = 0; if ( now.get(Calendar.DAY_OF_YEAR) - birth.get(Calendar.DAY_OF_YEAR) < 0) { adjust = -1; } age = now.get(Calendar.YEAR) - birth.get(Calendar.YEAR) + adjust; } } public class LastUpdateListener { /** * automatic property set before any database persistence */ @PreUpdate @PrePersist public void setLastUpdate(Cat o) { o.setLastUpdate( new Date() ); } }
Specification | JSR | Version | Java.net Project |
Java Platform, Enterprise Edition | 342 | 7 | javaee-spec |
Managed Beans | 342 | 1.0 | |
Java EE Web Profile (Web Profile) | 342 | 1.0 | |
Java API for RESTful Web Services (JAX-RS) | 339 | 2.0 | jax-rs-spec |
Web Services for Java EE | 109 | 1.4 | |
Java API for XML-Based Web Services (JAX-WS) | 224 | 2.2 | jax-ws |
Java Architecture for XML Binding (JAXB) | 222 | 2.2 | jaxb |
Web Services Metadata for the Java Platform | 181 | 2.1 | |
Java API for XML-Based RPC (JAX-RPC) (Optional) | 101 | 1.1 | jax-rpc |
Java API for XML Registries (JAXR) (Optional) | 93 | 1.0 | |
Servlet | 340 | 3.1 | |
JavaServer Faces(JSF) | 344 | 2.2 | javaserverfaces |
JavaServer Pages (JSP) | 245 | 2.3 | |
JavaServer Pages Expression Language (EL) | 341 | 3.0 | el-spec |
A Standard Tag Library for JavaServer Pages (JSTL) | 52 | 1.2 | jstl |
Debugging Support for Other Languages | 45 | 1.0 | |
Contexts and Dependency Injection for the Java EE Platform (CDI) | 346 | 1.1 | github.com |
Dependency Injection for Java (DI) | 330 | 1.0 | |
Bean Validation | 349 | 1.1 | http://beanvalidation.org |
Enterprise JavaBeans (EJB) | 345 | 3.2 | ejb-spec |
Java EE Connector Architecture (JCA) | 322 | 1.7 | |
Java Persistence (JPA) | 338 | 2.1 | jpa-spec |
Common Annotations for the Java Platform | 250 | 1.2 | |
Java Message Service API (JMS) | 343 | 2.0 | |
Java Transaction API (JTA) | 907 | 1.2 | jta-spec |
JavaMail | 919 | 1.5 | javamail |
Java Authentication Service Provider Interface for Containers (JASPIC) | 196 | 1.1 | jaspic-spec |
Java Authorization Contract for Containers (JACC) | 115 | 1.5 | jacc-spec |
Java EE Application Deployment (Optional) | 88 | 1.2 | |
Java Database Connectivity (JDBC) | 221 | 4.0 | |
Java Management Extensions (JMX) | 255 | 2.0 | openjdk |
JavaBeans Activation Framework (JAF) | 925 | 1.1 | |
Streaming API for XML (StAX) | 173 | 1.0 | sjsxp |
Java Authentication and Authorization Service (JAAS) | 1.0 | ||
Interceptors | 318 | 1.2 | |
Batch Applications for the Java Platform | 352 | 1.0 | jbatch |
Java API for JSON Processing | 353 | 1.0 | json-processing-spec |
Java API for WebSocket | 356 | 1.0 | websocket-spec |
Concurrency Utilities for Java EE | 236 | 1.0 | concurrency-ee-spec |