Java EE 7's JSF 2.2, Interceptors 1.2, and JPA 2.1 Intro Videos

Java EE 7 Launch Webinar sessions.


Here's the JSF 2.2 session:


Here's the Interceptors 1.1 session:


Here's the JPA 2.1 session:



EJB transactions: going deeper

In below article the autor explains in some words how works EJB technology, particularly about EJB transaction management
Full article

@Stateless  
public class MyFirstEjbBean implements MyFirstEjb {  
  
  @EJB  
  private MySecondEjb other;  
  
  public void firstEjb(){  
  
    other.secondEjb();  
  }  
}  
  
  
@Stateless  
public class MySecondEjbBean implements MySecondEjb {  
  
  public void secondEjb(){  
  
  }  
} 

Hibernate - Callback methods

Callbacks Methods: It is often useful for the application to react to certain events that occur inside the persistence mechanism.


TypeDescription
@PrePersistExecuted before the entity manager persist operation is actually executed or cascaded. This call is synchronous with the persist operation.
@PreRemoveExecuted before the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation.
@PostPersistExecuted after the entity manager persist operation is actually executed or cascaded. This call is invoked after the database INSERT is executed.
@PostRemoveExecuted after the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation.
@PreUpdateExecuted before the database UPDATE operation.
@PostUpdateExecuted after the database UPDATE operation.
@PostLoadExecuted after an entity has been loaded into the current persistence context or an entity has been refreshed.

Example
@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() );
    }
}


Source

Java EE 7 is final

Here is what EE 7 looks like as of today


The complete specification now contains 34 individual specifications.
SpecificationJSRVersionJava.net Project
Java Platform, Enterprise Edition3427javaee-spec
Managed Beans3421.0
Java EE Web Profile (Web Profile)3421.0
Java API for RESTful Web Services (JAX-RS)3392.0jax-rs-spec
Web Services for Java EE1091.4
Java API for XML-Based Web Services (JAX-WS)2242.2jax-ws
Java Architecture for XML Binding (JAXB)2222.2jaxb
Web Services Metadata for the Java Platform1812.1
Java API for XML-Based RPC (JAX-RPC) (Optional)1011.1jax-rpc
Java API for XML Registries (JAXR) (Optional)931.0
Servlet3403.1
JavaServer Faces(JSF)3442.2javaserverfaces
JavaServer Pages (JSP)2452.3
JavaServer Pages Expression Language (EL)3413.0el-spec
A Standard Tag Library for JavaServer Pages (JSTL)521.2jstl
Debugging Support for Other Languages451.0
Contexts and Dependency Injection for the Java EE Platform (CDI)3461.1github.com
Dependency Injection for Java (DI)3301.0
Bean Validation3491.1http://beanvalidation.org
Enterprise JavaBeans (EJB)3453.2ejb-spec
Java EE Connector Architecture (JCA)3221.7
Java Persistence (JPA)3382.1jpa-spec
Common Annotations for the Java Platform2501.2
Java Message Service API (JMS)3432.0
Java Transaction API (JTA)9071.2jta-spec
JavaMail9191.5javamail
Java Authentication Service Provider Interface for Containers (JASPIC)1961.1jaspic-spec
Java Authorization Contract for Containers (JACC)1151.5jacc-spec
Java EE Application Deployment (Optional)881.2
Java Database Connectivity (JDBC)2214.0
Java Management Extensions (JMX)2552.0openjdk
JavaBeans Activation Framework (JAF)9251.1
Streaming API for XML (StAX)1731.0sjsxp
Java Authentication and Authorization Service (JAAS)1.0
Interceptors3181.2
Batch Applications for the Java Platform3521.0jbatch
Java API for JSON Processing3531.0json-processing-spec
Java API for WebSocket3561.0websocket-spec
Concurrency Utilities for Java EE2361.0concurrency-ee-spec

Source

Setup of Dynamic Web Project using Maven

Good article that show how to create a Dynamic Web Project using Maven.

Full article here.

In same blog i found other interesting article about
Spring JPA Data + Hibernate + MySQL + MAVEN that show how we can develop a web-applications with the help of Spring MVC.

Powered by Blogger