SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
What's new in Java EE 7?

Java User Group Berlin Brandenburg
04.12.2013
Dirk Weil, GEDOPLAN GmbH
Dirk Weil
CEO of GEDOPLAN GmbH, Bielefeld, Germany
Java EE since 1998
Conceptual design
and implementation
Talks
Training
Books & articles

Power Workshop Java EE 7

2
Java EE
1.0

1998

1.1
1.2

1.3
1.4

2001

Annotations

2002

CDI
2006

5

What's new in Java EE 7?

2013

2010

7
6

3
Java EE-related
Specs in Java SE

Management
and Security
Technologies

Web Services
Technologies

Enterprise Application Technologies

Web Application
Technologies

Java EE
Platform

Java EE 7

What's new in Java EE 7?

Specification
Java Platform, Enterprise Edition 7
Java API for WebSocket
Java API for JSON Processing
Java Servlet 3.1
JavaServer Faces 2.2
Expression Language 3.0
JavaServer Pages 2.3
Standard Tag Library for JavaServer Pages 1.2
Batch Applications for the Java Platform
Concurrency Utilities for Java EE 1.0
Contexts and Dependency Injection for Java 1.1
Dependency Injection for Java 1.0
Bean Validation 1.1
Enterprise JavaBeans 3.2
Interceptors 1.2
Java EE Connector Architecture 1.7
Java Persistence 2.1
Common Annotations for the Java Platform 1.2
Java Message Service API 2.0
Java Transaction API 1.2
JavaMail 1.5
Java API for RESTful Web Services 2.0
Implementing Enterprise Web Services 1.3
Java API for XML-Based Web Services 2.2
Web Services Metadata for the Java Platform
Java API for XML-Based RPC 1.1 (Optional)
Java APIs for XML Messaging 1.3
Java API for XML Registries 1.0
Java Authentication Service Provider Interface for Containers 1.1
Java Authorization Contract for Containers 1.5
Java EE Application Deployment 1.2 (Optional)
J2EE Management 1.1
Debugging Support for Other Languages 1.0
Java Architecture for XML Binding 2.2
Java API for XML Processing 1.3
Java Database Connectivity 4.0
Java Management Extensions 2.0
JavaBeans Activation Framework 1.1
Streaming API for XML 1.0

Web Profile?
Java EE JSR 342
JSR 356
JSR 353
JSR 340
JSR 344
JSR 341
JSR 245
JSR 52
JSR 352
JSR 236
CDI
JSR 346
JSR 330
BV
JSR 349
EJB
JSR 345
JSR 318
JCA
JSR 322
JPA
JSR 338
JSR 250
JMS
JSR 343
JTA
JSR 907
Mail
JSR 919
JAX-RS JSR 339
JSR 109
JAX-WS JSR 224
JSR 181
JAX-RPC JSR 101
JSR 67
JAXR
JSR 93
JSR 196
JACC
JSR 115
JSR 88
JSR 77
JSR 45
JAXB
JSR 222
JAXP
JSR 206
JDBC
JSR 221
JMX
JSR 003
JAF
JSR 925
StAX
JSR 173
JSON-P
Servlet
JSF
EL
JSP
JSTL
Batch















JSF 2.2
CDI 1.1

JPA 2.1






JAX-RS 2.0



4
JavaServer Faces 2.2
Big Ticket Features
Faces Flows
Resource Library Contracts
HTML 5 Friendly Markup
Stateless Views
Several minor enhancements

What's new in Java EE 7?

5
JSF 2.2: Faces Flows
Combination of various views
Internal navigation
Dedicated entry and return views
"Subroutine"
Embeddable
Flow scoped values
and beans

What's new in Java EE 7?

6
JSF 2.2: Faces Flows
Various flow definitions
Simple, directory-based
Flow descriptor
CDI Producer
Location
Web app root
Library JAR
META-INF/flows

What's new in Java EE 7?

7
JSF 2.2: Resource Library Contracts
Encapsulation of templates, images, CSS, JS
Subdirectory of
WebappRoot/contracts
Library JAR
META-INF/contracts

What's new in Java EE 7?

8
JSF 2.2: Resource Library Contracts
Activation
f:view

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core" …>
<f:view contracts="default">

faces-config.xml
<faces-config version="2.2" …>
<application>
<resource-library-contracts>
<contract-mapping>
<url-pattern>*</url-pattern>
<contracts>jugbb</contracts>
</contract-mapping>
</resource-library-contracts>
What's new in Java EE 7?

9
JSF 2.2: HTML 5 Friendly Markup
Passthrough elements:
Use HTML 5 tags with JSF attributes
<input jsf:id="email" jsf:value="#{demoModel.email}“
type="email" name="email" size="40" required="required"/>

Passthrough attributes:
Use JSF tags with HTML 5 attributes
<h:inputText id="nights" value="#{demoModel.nights}" >
<f:passThroughAttribute name="type" value="number" />
<f:passThroughAttribute name="size" value="40" />
</h:inputText>

What's new in Java EE 7?

10
JSF 2.2: More Changes
Stateless Views
<f:view transient="true">
UIData supports Collection
@ViewScoped
javax.faces.bean deprecated in next version
(@ManagedBean etc.)

What's new in Java EE 7?

11
Java Persistence API 2.1
Converter
JPQL & Criteria Query Enhancements
CDI Injection in Entity Listener
DDL Handling
Entity Graphs

What's new in Java EE 7?

12
JPA 2.1: Converter
@Convert
Explicit type / value mapping
replaces „User Types“ etc.
generalizes @Enumerated, @Temporal
@Entity
public class Country
{
@Convert(converter = YesNoConverter.class)
private boolean expired;

What's new in Java EE 7?

13
JPA 2.1: Converter
@Converter
declares converter
can be auto-applied (autoApply = true)
@Converter
public class YesNoConverter implements AttributeConverter<Boolean, String> {
public String convertToDatabaseColumn(Boolean fieldValue) {
if (fieldValue == null) return null;
return fieldValue ? "Y" : "N";
}
public Boolean convertToEntityAttribute(String columnValue) {
if (columnValue == null) return null;
return columnValue.equals("Y");

What's new in Java EE 7?

14
JPA 2.1: JPQL & Criteria Query Enhancements
ON: Join filter

select p.name, count(b)
from Publisher p
left join p.books b
on b.bookType = BookType.PAPERBACK
group by p.name

TREAT: Downcast (includes filter)
select s from StorageLocation s
where treat(s.product as Book).bookType = BookType.HARDCOVER

FUNCTION: Call DB function
select c from Customer c
where function('hasGoodCredit', c.balance, c.creditLimit)

What's new in Java EE 7?

15
JPA 2.1: JPQL & Criteria Query Enhancements
Bulk Update/Delete for Criteria Query
CriteriaUpdate<Product> criteriaUpdate
= criteriaBuilder.createCriteriaUpdate(Product.class);
Root<Product> p = criteriaUpdate.from(Product.class);
Path<Number> price = p.get(Product_.price);
criteriaUpdate.set(price, criteriaBuilder.prod(price, 1.03));

entityManager.createQuery(criteriaUpdate).executeUpdate();

Stored Procedure Queries
StoredProcedureQuery query
= entityManager.createStoredProcedureQuery("findMissingProducts");
What's new in Java EE 7?

16
JPA 2.1: CDI Injection in Entity Listener

public class CountryListener {
@Inject
private AuditService auditService;
@PreUpdate
public void preUpdate(Object entity) {
this.auditService.logUpdate(entity);
}
@Entity
@EntityListeners(CountryListener.class)
public class Country {

What's new in Java EE 7?

17
JPA 2.1: DDL Handling
Create and/or drop db tables
Based on entity meta data (mapping)
SQL script
Data load script
<persistence … >
<persistence-unit name="test">
…
<properties>
<property name="javax.persistence.schema-generation.database.action"
value="drop-and-create" />
<property name="javax.persistence.schema-generation.create-script-source"
value="META-INF/create.sql" />
<property name="javax.persistence.schema-generation.create-source"
value="metadata-then-script" />
<property name="javax.persistence.sql-load-script-source"
value="META-INF/sqlLoad.sql" />
What's new in Java EE 7?

18
JPA 2.1: DDL Handling
Write create and/or drop scripts
Writer createWriter = …; // File, String …

Map<String, Object> properties = new HashMap<>();
properties.put("javax.persistence.schema-generation.scripts.action",
"create");
properties.put("javax.persistence.schema-generation.scripts.create-target",
createWriter);
Persistence.generateSchema("test", properties);

What's new in Java EE 7?

19
JPA 2.1: Entity Graphs
Declaration of lazy attributes to be loaded
@Entity
@NamedEntityGraph(name = "Publisher_books",
attributeNodes = @NamedAttributeNode(value = "books")))
public class Publisher
{
…
@OneToMany(mappedBy = "publisher", fetch = FetchType.LAZY)
private List<Book> books;

find parameter or query hint
fetchgraph: Fetch entity graph attributes only
loadgraph: Fetch eager attributes also
TypedQuery<Publisher> query = entityManager.createQuery(…);
query.setHint("javax.persistence.fetchgraph", "Publisher_books");
What's new in Java EE 7?

20
CDI 1.1
Enhanced bean discovery
Global enablement of interceptors, decorators, alternatives
Constructor interception
Transaction support
Validation for parameters and return values

What's new in Java EE 7?

21
CDI 1.1: Bean Discovery
Discovery mode: all, annotated, none
Exclusion filter: Class or package
<beans … bean-discovery-mode="all" version="1.1">

<scan>
<exclude name="de.gedoplan.….sub1.beans.DiscoverableBean12"/>
<exclude name="de.gedoplan.….sub1.beans.excluded.**"/>
<exclude name="de.gedoplan.….dummy.**">
<if-system-property name="NO_DUMMY" value="true" />
</exclude>
</scan>
</beans>

What's new in Java EE 7?

22
CDI 1.1: Global Enablement of Interceptors etc.
@Priority
Interceptors & decorators
global enablement
Order
@TraceCall
@Interceptor
@Priority(Interceptor.Priority.APPLICATION + 1)
public class TraceCallInterceptor
{

Alternatives
Global activation of alternative with highest priority

What's new in Java EE 7?

23
CDI 1.1: Constructor Interception
@TraceCall @Interceptor @Priority(…)
public class TraceCallInterceptor
{
@AroundConstruct
public Object traceConstructorCall(InvocationContext ic)
throws Exception
{
…
}
@AroundInvoke
public Object traceMethodCall(InvocationContext ic)
throws Exception
{
…
}
What's new in Java EE 7?

24
CDI 1.1: Transaction Support
Platform global transaction interceptor @Transactional
TX modes like EJB TX attributes
@Transactional(value = TxType.REQUIRED,
dontRollbackOn={HarmlessException.class})
public void insert(Cocktail cocktail)
{

CDI scope @TransactionScoped

What's new in Java EE 7?

25
CDI 1.1: Bean Validation for Parameters and Return Values

@NotNull
public List<Questionnaire> createPoll(@Min(10) int
{

What's new in Java EE 7?

size)

26
Restful Webservices (JAX-RS)
Out-of-the-Box
JSON Support

@Path("country")
@Produces(MediaType.APPLICATION_JSON)
public class CountryResource
{
@GET
public List<Country> getAll()
{
…

Client API
Client client = ClientBuilder.newClient();
WebTarget target = client.target(“http://.../country/DE");
Country country = target.request(MediaType.APPLICATION_XML)
.get(Country.class);

What's new in Java EE 7?

27
More new things
Websockets
Concurrency Utilities
Batch

JMS

What's new in Java EE 7?

28
Platforms
GlassFish 4
Reference implementation
Stable version: 4.0
Promoted build: 4.0.1 b03
WildFly 8
Formerly known as JBoss AS
Current version: 8.0.0.Beta1

What's new in Java EE 7?

29
Links
Sample Project

https://github.com/dirkweil/whatsNewInJavaEe7
Java EE Blog

http://javaeeblog.wordpress.com/
Consulting

http://www.gedoplan.de
dirk.weil@gedoplan.de
Training

http://www.ips-it-schulungen.de/
What's new in Java EE 7?

30
Schön, dass Sie da waren!

dirk.weil@gedoplan.de

Más contenido relacionado

La actualidad más candente

Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
guest11106b
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
Ram132
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
Guo Albert
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
 

La actualidad más candente (20)

Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
DataFX - JavaOne 2013
DataFX - JavaOne 2013DataFX - JavaOne 2013
DataFX - JavaOne 2013
 
Dao pattern
Dao patternDao pattern
Dao pattern
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Jpa
JpaJpa
Jpa
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
Hibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesHibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examples
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginners
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPA
 
Java Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet AdvancedJava Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet Advanced
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 

Similar a JUG Berlin Brandenburg: What's new in Java EE 7?

Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
Allan Huang
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
knight1128
 
Java 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for youJava 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for you
Dmitry Buzdin
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser Comparison
Allan Huang
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0
Jeffrey West
 

Similar a JUG Berlin Brandenburg: What's new in Java EE 7? (20)

Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
Slice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed PersistenceSlice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed Persistence
 
Javaee6 Overview
Javaee6 OverviewJavaee6 Overview
Javaee6 Overview
 
Java EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's QuarrelJava EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's Quarrel
 
Java ee 7 New Features
Java ee 7   New FeaturesJava ee 7   New Features
Java ee 7 New Features
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
What's new in Java EE 7
What's new in Java EE 7What's new in Java EE 7
What's new in Java EE 7
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
 
Java 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for youJava 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for you
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser Comparison
 
Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014
 
What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
Jpa 2.0 in java ee 6 part ii
Jpa 2.0 in java ee 6  part iiJpa 2.0 in java ee 6  part ii
Jpa 2.0 in java ee 6 part ii
 
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

JUG Berlin Brandenburg: What's new in Java EE 7?

  • 1. What's new in Java EE 7? Java User Group Berlin Brandenburg 04.12.2013 Dirk Weil, GEDOPLAN GmbH
  • 2. Dirk Weil CEO of GEDOPLAN GmbH, Bielefeld, Germany Java EE since 1998 Conceptual design and implementation Talks Training Books & articles Power Workshop Java EE 7 2
  • 4. Java EE-related Specs in Java SE Management and Security Technologies Web Services Technologies Enterprise Application Technologies Web Application Technologies Java EE Platform Java EE 7 What's new in Java EE 7? Specification Java Platform, Enterprise Edition 7 Java API for WebSocket Java API for JSON Processing Java Servlet 3.1 JavaServer Faces 2.2 Expression Language 3.0 JavaServer Pages 2.3 Standard Tag Library for JavaServer Pages 1.2 Batch Applications for the Java Platform Concurrency Utilities for Java EE 1.0 Contexts and Dependency Injection for Java 1.1 Dependency Injection for Java 1.0 Bean Validation 1.1 Enterprise JavaBeans 3.2 Interceptors 1.2 Java EE Connector Architecture 1.7 Java Persistence 2.1 Common Annotations for the Java Platform 1.2 Java Message Service API 2.0 Java Transaction API 1.2 JavaMail 1.5 Java API for RESTful Web Services 2.0 Implementing Enterprise Web Services 1.3 Java API for XML-Based Web Services 2.2 Web Services Metadata for the Java Platform Java API for XML-Based RPC 1.1 (Optional) Java APIs for XML Messaging 1.3 Java API for XML Registries 1.0 Java Authentication Service Provider Interface for Containers 1.1 Java Authorization Contract for Containers 1.5 Java EE Application Deployment 1.2 (Optional) J2EE Management 1.1 Debugging Support for Other Languages 1.0 Java Architecture for XML Binding 2.2 Java API for XML Processing 1.3 Java Database Connectivity 4.0 Java Management Extensions 2.0 JavaBeans Activation Framework 1.1 Streaming API for XML 1.0 Web Profile? Java EE JSR 342 JSR 356 JSR 353 JSR 340 JSR 344 JSR 341 JSR 245 JSR 52 JSR 352 JSR 236 CDI JSR 346 JSR 330 BV JSR 349 EJB JSR 345 JSR 318 JCA JSR 322 JPA JSR 338 JSR 250 JMS JSR 343 JTA JSR 907 Mail JSR 919 JAX-RS JSR 339 JSR 109 JAX-WS JSR 224 JSR 181 JAX-RPC JSR 101 JSR 67 JAXR JSR 93 JSR 196 JACC JSR 115 JSR 88 JSR 77 JSR 45 JAXB JSR 222 JAXP JSR 206 JDBC JSR 221 JMX JSR 003 JAF JSR 925 StAX JSR 173 JSON-P Servlet JSF EL JSP JSTL Batch             JSF 2.2 CDI 1.1 JPA 2.1     JAX-RS 2.0  4
  • 5. JavaServer Faces 2.2 Big Ticket Features Faces Flows Resource Library Contracts HTML 5 Friendly Markup Stateless Views Several minor enhancements What's new in Java EE 7? 5
  • 6. JSF 2.2: Faces Flows Combination of various views Internal navigation Dedicated entry and return views "Subroutine" Embeddable Flow scoped values and beans What's new in Java EE 7? 6
  • 7. JSF 2.2: Faces Flows Various flow definitions Simple, directory-based Flow descriptor CDI Producer Location Web app root Library JAR META-INF/flows What's new in Java EE 7? 7
  • 8. JSF 2.2: Resource Library Contracts Encapsulation of templates, images, CSS, JS Subdirectory of WebappRoot/contracts Library JAR META-INF/contracts What's new in Java EE 7? 8
  • 9. JSF 2.2: Resource Library Contracts Activation f:view <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" …> <f:view contracts="default"> faces-config.xml <faces-config version="2.2" …> <application> <resource-library-contracts> <contract-mapping> <url-pattern>*</url-pattern> <contracts>jugbb</contracts> </contract-mapping> </resource-library-contracts> What's new in Java EE 7? 9
  • 10. JSF 2.2: HTML 5 Friendly Markup Passthrough elements: Use HTML 5 tags with JSF attributes <input jsf:id="email" jsf:value="#{demoModel.email}“ type="email" name="email" size="40" required="required"/> Passthrough attributes: Use JSF tags with HTML 5 attributes <h:inputText id="nights" value="#{demoModel.nights}" > <f:passThroughAttribute name="type" value="number" /> <f:passThroughAttribute name="size" value="40" /> </h:inputText> What's new in Java EE 7? 10
  • 11. JSF 2.2: More Changes Stateless Views <f:view transient="true"> UIData supports Collection @ViewScoped javax.faces.bean deprecated in next version (@ManagedBean etc.) What's new in Java EE 7? 11
  • 12. Java Persistence API 2.1 Converter JPQL & Criteria Query Enhancements CDI Injection in Entity Listener DDL Handling Entity Graphs What's new in Java EE 7? 12
  • 13. JPA 2.1: Converter @Convert Explicit type / value mapping replaces „User Types“ etc. generalizes @Enumerated, @Temporal @Entity public class Country { @Convert(converter = YesNoConverter.class) private boolean expired; What's new in Java EE 7? 13
  • 14. JPA 2.1: Converter @Converter declares converter can be auto-applied (autoApply = true) @Converter public class YesNoConverter implements AttributeConverter<Boolean, String> { public String convertToDatabaseColumn(Boolean fieldValue) { if (fieldValue == null) return null; return fieldValue ? "Y" : "N"; } public Boolean convertToEntityAttribute(String columnValue) { if (columnValue == null) return null; return columnValue.equals("Y"); What's new in Java EE 7? 14
  • 15. JPA 2.1: JPQL & Criteria Query Enhancements ON: Join filter select p.name, count(b) from Publisher p left join p.books b on b.bookType = BookType.PAPERBACK group by p.name TREAT: Downcast (includes filter) select s from StorageLocation s where treat(s.product as Book).bookType = BookType.HARDCOVER FUNCTION: Call DB function select c from Customer c where function('hasGoodCredit', c.balance, c.creditLimit) What's new in Java EE 7? 15
  • 16. JPA 2.1: JPQL & Criteria Query Enhancements Bulk Update/Delete for Criteria Query CriteriaUpdate<Product> criteriaUpdate = criteriaBuilder.createCriteriaUpdate(Product.class); Root<Product> p = criteriaUpdate.from(Product.class); Path<Number> price = p.get(Product_.price); criteriaUpdate.set(price, criteriaBuilder.prod(price, 1.03)); entityManager.createQuery(criteriaUpdate).executeUpdate(); Stored Procedure Queries StoredProcedureQuery query = entityManager.createStoredProcedureQuery("findMissingProducts"); What's new in Java EE 7? 16
  • 17. JPA 2.1: CDI Injection in Entity Listener public class CountryListener { @Inject private AuditService auditService; @PreUpdate public void preUpdate(Object entity) { this.auditService.logUpdate(entity); } @Entity @EntityListeners(CountryListener.class) public class Country { What's new in Java EE 7? 17
  • 18. JPA 2.1: DDL Handling Create and/or drop db tables Based on entity meta data (mapping) SQL script Data load script <persistence … > <persistence-unit name="test"> … <properties> <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" /> <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/create.sql" /> <property name="javax.persistence.schema-generation.create-source" value="metadata-then-script" /> <property name="javax.persistence.sql-load-script-source" value="META-INF/sqlLoad.sql" /> What's new in Java EE 7? 18
  • 19. JPA 2.1: DDL Handling Write create and/or drop scripts Writer createWriter = …; // File, String … Map<String, Object> properties = new HashMap<>(); properties.put("javax.persistence.schema-generation.scripts.action", "create"); properties.put("javax.persistence.schema-generation.scripts.create-target", createWriter); Persistence.generateSchema("test", properties); What's new in Java EE 7? 19
  • 20. JPA 2.1: Entity Graphs Declaration of lazy attributes to be loaded @Entity @NamedEntityGraph(name = "Publisher_books", attributeNodes = @NamedAttributeNode(value = "books"))) public class Publisher { … @OneToMany(mappedBy = "publisher", fetch = FetchType.LAZY) private List<Book> books; find parameter or query hint fetchgraph: Fetch entity graph attributes only loadgraph: Fetch eager attributes also TypedQuery<Publisher> query = entityManager.createQuery(…); query.setHint("javax.persistence.fetchgraph", "Publisher_books"); What's new in Java EE 7? 20
  • 21. CDI 1.1 Enhanced bean discovery Global enablement of interceptors, decorators, alternatives Constructor interception Transaction support Validation for parameters and return values What's new in Java EE 7? 21
  • 22. CDI 1.1: Bean Discovery Discovery mode: all, annotated, none Exclusion filter: Class or package <beans … bean-discovery-mode="all" version="1.1"> <scan> <exclude name="de.gedoplan.….sub1.beans.DiscoverableBean12"/> <exclude name="de.gedoplan.….sub1.beans.excluded.**"/> <exclude name="de.gedoplan.….dummy.**"> <if-system-property name="NO_DUMMY" value="true" /> </exclude> </scan> </beans> What's new in Java EE 7? 22
  • 23. CDI 1.1: Global Enablement of Interceptors etc. @Priority Interceptors & decorators global enablement Order @TraceCall @Interceptor @Priority(Interceptor.Priority.APPLICATION + 1) public class TraceCallInterceptor { Alternatives Global activation of alternative with highest priority What's new in Java EE 7? 23
  • 24. CDI 1.1: Constructor Interception @TraceCall @Interceptor @Priority(…) public class TraceCallInterceptor { @AroundConstruct public Object traceConstructorCall(InvocationContext ic) throws Exception { … } @AroundInvoke public Object traceMethodCall(InvocationContext ic) throws Exception { … } What's new in Java EE 7? 24
  • 25. CDI 1.1: Transaction Support Platform global transaction interceptor @Transactional TX modes like EJB TX attributes @Transactional(value = TxType.REQUIRED, dontRollbackOn={HarmlessException.class}) public void insert(Cocktail cocktail) { CDI scope @TransactionScoped What's new in Java EE 7? 25
  • 26. CDI 1.1: Bean Validation for Parameters and Return Values @NotNull public List<Questionnaire> createPoll(@Min(10) int { What's new in Java EE 7? size) 26
  • 27. Restful Webservices (JAX-RS) Out-of-the-Box JSON Support @Path("country") @Produces(MediaType.APPLICATION_JSON) public class CountryResource { @GET public List<Country> getAll() { … Client API Client client = ClientBuilder.newClient(); WebTarget target = client.target(“http://.../country/DE"); Country country = target.request(MediaType.APPLICATION_XML) .get(Country.class); What's new in Java EE 7? 27
  • 28. More new things Websockets Concurrency Utilities Batch JMS What's new in Java EE 7? 28
  • 29. Platforms GlassFish 4 Reference implementation Stable version: 4.0 Promoted build: 4.0.1 b03 WildFly 8 Formerly known as JBoss AS Current version: 8.0.0.Beta1 What's new in Java EE 7? 29
  • 30. Links Sample Project https://github.com/dirkweil/whatsNewInJavaEe7 Java EE Blog http://javaeeblog.wordpress.com/ Consulting http://www.gedoplan.de dirk.weil@gedoplan.de Training http://www.ips-it-schulungen.de/ What's new in Java EE 7? 30
  • 31. Schön, dass Sie da waren! dirk.weil@gedoplan.de