Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
<Insert Picture Here>
111
Java Enterprise Edition 6 UpdateScott SeighmanSr. Sales Consultant
Cleveland Java Users Group
Cleveland Java Users Group – March '10 2222
Agenda
• Brief Java Update• Java Enterprise Edition Overview• Major Themes in Java EE 6• What’s New in Java EE 6• What’s Updated in Java EE 6• Q&A
Cleveland Java Users Group – March '10 3333
Java is the Most Popular Language in the World
Cleveland Java Users Group – March '10 4444
The Spectrum of Java
MobileDesktops
Embedded
TV CardsServers
Java Language
Java EEJavaFX
Language
VMs
APIs
Cleveland Java Users Group – March '10 5555
Java Strategy
• Drive continued investment in the Java platform across a range of servers and devices
• Fuel further innovation in the Java platform, including JavaFX
• Continue supporting developer community, open source, and JCP
Cleveland Java Users Group – March '10 6666
Java SE• Drive rapid delivery of Java SE 7
– Modularization– Developer productivity– Multiple languages– Higher performance– Support for multi-core processors
• HotSpot joins JRockit as strategic JVM– Converge best features of HotSpot and JRockit:
• World-leading performance• Fine-grained monitoring and management• Automated and manual performance tuning• Run on virtualized servers with no OS• Leverage multi-core with NUMA optimization• Extremely efficient garbage collection• Deterministic, real time behavior
• Continue support for all leading OS platforms
Cleveland Java Users Group – March '10 7777
JavaFX and Rich User Experiences• Extend Java to provide unmatched
user interface capabilities– Design-oriented with visual assembly– Higher productivity with comprehensive
library of UI components– Rich user experiences with high
performance and extensibility– Seamless interoperability across Java,
JavaScript, and HTML 5• Portable across devices – desktop,
mobile, TV, and other form factors• Complements Oracle ADF and
ADF Mobile for enterprise applications
Cleveland Java Users Group – March '10 8888
Java EE
• Java EE continues to evolve in important areas– Modularity with open standards– New, footprint-optimizing server “Profiles”– Richer UI and Web applications– Support for dynamic/scripting
languages– Optimized Web services stack
• GlassFish– GlassFish remains Java EE reference implementation
and for tactical applications
Cleveland Java Users Group – March '10 9999
Java for Business
• Customized versions of Java SE with dedicated support for enterprises with special needs
• Best of platform standardization AND customized capabilities
• Future-proof your investment
Cleveland Java Users Group – March '10 10101010
JavaOne
• JavaOne continues as the premier open community event for Java– Co-located with Oracle OpenWorld,
San Francisco, September 19-23 2010
• Expanding to other countries– Brazil– Russia– India– China
Cleveland Java Users Group – March '10 11111111
Java EE Overview
• Java Enterprise Edition (Java EE) has evolved as an enterprise application deployment platform from several themes: – Robustness– Web Services– Ease of deployment
• Continually shaped by users through the Java Community Process (JCP)
• Java EE is a universal standard in enterprise IT, facilitating the development, deployment, and management of multitier, server-centric applications.
Cleveland Java Users Group – March '10 12121212
Java PlatformTM Enterprise Edition
Enterprise Java Platform
Robustness
WebServices
Ease ofDevelopment
Java EE 5Ease of
Development Annotations
EJB 3.0Persistence
New andUpdated
Web Services
J2EE 1.4Web
Services Management Deployment
Async. Connector
J2EE 1.3CMP
ConnectorArchitecture
J2EE 1.2Servlet
JSPEJBJMS
RMI/IIOP
Cleveland Java Users Group – March '10 13131313
What is an Application Server?
• Various API combinations packaged into “containers”• Each container based on Java SE• APIs and mechanisms for enterprise-class:
– Objects– User interface
Java, Enterprise Edition (EE)
– Integration– Persistence
– Transactions– Security
Cleveland Java Users Group – March '10 14141414
Application Servers and Application Grid
Traditional World• Dedicated stacks• No scale-out• Expensive, slow capacity
expansion/adjustment• Inefficient utilization
Application Grid• Pooled, shared HW• Scale-out with app server clustering• Automated, instant adjustment• Efficient utilization, optimized
across data center
App Server App
App Server App ServerApp Server
App
Cleveland Java Users Group – March '10 15151515
Application Grid
Lowest operational
costs
Pooling and sharing of resources
Automated, dynamic adjustment
Custom App
Packaged App
SOA Service
C/C++/ COBOL Legacy
Outperform with speed and flexibility
Best foundation for entire
software stack
Application Grid
Cleveland Java Users Group – March '10 16161616
<Insert Picture Here>
Java EE 6
Cleveland Java Users Group – March '10 17171717
Major Themes of Java EE 6• Right-sizing
– Profiles & Pruning– Use only what you need– Web profile, EJB Lite
• Extensibility (Pluggability)– Use 3rd-party frameworks or libraries
without extra configuration• Ease of development
– Default over configuration– Dependency Injection (DI)
Cleveland Java Users Group – March '10 18181818
Java PlatformTM Enterprise Edition
Java EE 6Web Profile
Enterprise Java Platform
Robustness
Java EE 6Pruning
ExtensibilityProfilesEase of
DevelopmentEJB LiteRESTfulServices
DependencyInjection
WebServices
Ease ofDevelopment
Flexible
Java EE 5Ease of
Development Annotations
EJB 3.0Persistence
New andUpdated
Web Services
J2EE 1.4Web
Services Management Deployment
Async. Connector
J2EE 1.3CMP
ConnectorArchitecture
J2EE 1.2Servlet JSPEJB JMS
RMI/IIOP
Lightweight
Cleveland Java Users Group – March '10 19191919
Pruning• Addresses bloat concern• Two step process:
> First declare “proposed optional”> Then make them fully optional in the next
release• Pruned in Java EE 6:
> JAX-RPC> EJB 2.x Entity Beans> JAXR> JSR-88 (Java EE Application Deployment)
Cleveland Java Users Group – March '10 20202020
Pruning
• Marks some specifications “deprecated” in next version– Might disappear from Java EE 7
• Pruning provides an orderly way to alert organizations that a technology will be removed from the specification in future releases
Cleveland Java Users Group – March '10 21212121
Profiles• Bundles of technologies targeting
specific classes of applications• Decoupled from each other• Recommended that they sync up with
the platform periodically• With compatibility guarantees
> Must implement all required technologies> Must satisfy all individual technology
requirements> Must satisfy all joint requirements
Cleveland Java Users Group – March '10 22222222
Web Profile
• A modern Java web application stack• First profile to be defined• Mid-size, fully functional• Complete, but not the kitchen sink• Pluggability takes care of any extensions
Cleveland Java Users Group – March '10 23232323
Web Profile Contents
• Servlet• JSP / EL• JSTL• JSF• Bean Validation • EJB Lite• JPA
• JTA• DI• CDI• Managed Beans• Interceptors• JSR-250
Cleveland Java Users Group – March '10 24242424
Pluggability / Extensibility
• Focus on the web tier• Create a level playing field for third
party libraries and frameworks• Two major extensibility points in
Servlets and CDI• Simplify packaging of web apps
> Zero-configuration
Cleveland Java Users Group – March '10 25252525
Extensibility
• Open source frameworks are a critical part of Enterprise Java development
• Java EE 6 Expert Group defined way for framework technologies to be integrated with the platform• Examples: Spring, Struts, GUICE
Frameworks
Cleveland Java Users Group – March '10 26262626
Pluggability (of 3rd party Frameworks)
• Make it possible to use 3rd-party framework and libraries without configuration in web.xml
• A framework is provided as a self-contained jar file
• All you have to do use the framework is to place the self-contained jar file under /WEB-INF/lib directory
Cleveland Java Users Group – March '10 27272727
Pluggability: Modularization of web.xml
• No more tweaking of single web.xml• Each framework defines its own web-
fragment.xml– Declare their own controller servlet– Declare listener and filters
• Container then collects them all• Overridden by main web.xml
– Order of the frameworks/libs can be specified in the web.xml
Cleveland Java Users Group – March '10 28282828
Pluggability: Modularization of web.xml
• A self-contained framework is provided as a jar file and placed under WEB-INF/lib– web.xml (optional)– WEB-INF/lib/someframework1.jar →
META-INF/web-fragment.xml– WEB-INF/lib/someframework2.jar →
META-INF/web-fragment.xml
Cleveland Java Users Group – March '10 29292929
Pluggability: Modularization of web.xml
<web-fragment><servlet> <servlet-name>MyFramework</servlet-name> <servlet-class>com.mycom.MyFrameworkServlet</servlet-
class></servlet><servlet-mapping> <servlet-name>MyFramework</servlet-name> <url-pattern>/MyFramework</url-pattern></servlet-mapping>...</web-fragment>
Cleveland Java Users Group – March '10 30303030
Pluggability and Extensibility
• Framework (Struts, Spring...) + Applications + .. = Big and complex web.xml
Cleveland Java Users Group – March '10 31313131
Productivity: Ease of DevelopmentAdding an EJB to a Web Application
Cleveland Java Users Group – March '10 32323232
Productivity: Less TypingServlet in Java EE 5: Create two source files
Cleveland Java Users Group – March '10 33333333
Productivity: AnnotationsServlet in Java EE 6: In many cases a single source file
Cleveland Java Users Group – March '10 34343434
Flexibility
• Subset of full Java EE Platform• Optimized for web applications• Smaller footprint• Fast startup and deployment• Technologies
• Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR 45, Common Annotations
Web Profile
Cleveland Java Users Group – March '10 35353535
<Insert Picture Here>
What’s New in Java EE 6
Cleveland Java Users Group – March '10 36363636
Java EE 6 Platform
• Several new APIs• Web Profile• Pluggability/extensibility• Dependency injection• Many improvements to individual APIs
What's New?
Cleveland Java Users Group – March '10 37373737
Java EE 6 Platform
• JAX-RS 1.1• Bean Validation 1.0• DI 1.0• CDI 1.0• Managed Beans 1.0
New Technologies
Cleveland Java Users Group – March '10 38383838
Java EE 6 Platform
• EJB 3.1• JPA 2.0• Servlet 3.0• JSF 2.0• Connectors 1.6• Interceptors 1.1
Updated Technologies
• JAX-WS 2.2• JSR-109 1.3• JSP 2.2• EL 2.2• JSR-250 1.1• JACC 1.4• JASPIC 1.0
Cleveland Java Users Group – March '10 39393939
JAX-RS 1.1
• Already widely adopted• Really a high-level HTTP API• Annotation-based programming model• Programmatic API when needed
Cleveland Java Users Group – March '10 40404040
JAX-RS Resource Class
Identified by the @Path annotation
@Path(“widgets/{id}”)@Produces(“application/widgets+xml”)public class WidgetResource { public WidgetResource(@PathParam(“id”) String id) { … } @GET Widget getWidget() { … }}
Cleveland Java Users Group – March '10 41414141
Bean Validation 1.0: What is it?
• Enable declarative validation in your applications
• Constrain Once, Validate Anywhere – restriction on a bean, field or property – Not null, size between 1 and 7, valid email...
• Standard way to validate constraints• Integration with JPA 2.0 & JSF 2.0
Cleveland Java Users Group – March '10 42424242
Bean Validation 1.0
• Integrated with JSF, JPA• Constraints represented by annotations @NotNull @Size(max=40) String address;• Fully extensible @Email String recipient;
Cleveland Java Users Group – March '10 43434343
DI 1.0 (JSR 330): What is it & Why?
• Stands for “Dependency Injection for Java”• Java EE 5 has resource injection
– @Resource, @PersistenceContext, @EJB• But there is no application level injection in
Java EE 5• DI 1.0 introduces @Inject annotation (and
others) for application level injection• Spec. leads are Bob Lee (from Google) and
Rod Johnson (from SpringSource)
Cleveland Java Users Group – March '10 44444444
Dependency Injection
• Combination of DI 1.0 / CDI 1.0• New @Inject annotation @Inject @LoggedIn User user;• Beans auto-discovered at startup• Extensible
> Injection metamodel (BeanManager API)• @Resource still available for container
resources
WHAT
Cleveland Java Users Group – March '10 45454545
Dependency Injection
• Combination of DI 1.0 / CDI 1.0• New @Inject annotation @Inject @LoggedIn User user;• Beans auto-discovered at startup• Extensible
> Injection metamodel (BeanManager API)• @Resource still available for container
resources
WHICH ONE
WHAT
Cleveland Java Users Group – March '10 46464646
Dependency Injection Sample
public class CheckoutHandler {
@Inject CheckoutHandler(@LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default Cart cart) { ... }
}
Cleveland Java Users Group – March '10 47474747
DI 1.0 (JSR 330)
• javax.inject package• @Inject : Identifies injectable
constructors, methods, and fields• @Named : String-based qualifier (for EL)• @Qualifier : Identifies qualifier• @Scope : Identifies scope annotations• @Singleton : Instantiates once
Cleveland Java Users Group – March '10 48484848
CDI 1.0 (JSR-299)Contexts and Dependency Injection• Used to be called “WebBeans”• Uses annotations defined in DI 1.0 (JSR-330) @Inject ShoppingCart cart;• Bean discovery and wiring
– Container discovers beans and wires everything together automatically
• Let you use EJBs directly as JSF backing beans• Every object managed by CDI has a well-defined
scope– @Dependent, @ConversationalScoped,
@RequestScoped, @SessionScoped, @ApplicationScoped
Cleveland Java Users Group – March '10 49494949
CDI 1.0 (JSR-299)
• Injected type is identified by– Qualifier(s) + Java type– e.g. @Inject @LoggedIn User user;– Qualifier is used to narrow down a
particular class when more than one candidate for injection exists
• Context management with scopes– @ConversationScoped– public class ShoppingCart { … }
Cleveland Java Users Group – March '10 50505050
Managed Bean 1.0: What is it?
• Managed Beans are container-managed POJOs– Lightweight component model
• Support a small set of basic services– Injection of a resource (@Resource...)– Life-cycle management (@PostConstruct,
@PreDestroy)– Interceptor (@Interceptors, @AroundInvoke)
Cleveland Java Users Group – March '10 51515151
Managed Bean vs. EJB and REST
• You could see everything as a Managed Bean with extra services
• An EJB is a Managed Bean with :– Transaction support– Security– Thread safety
• A REST service is a Managed Bean with HTTP support
Cleveland Java Users Group – March '10 52525252
EJB 3.1
• Packaging in a war file• Optional Local Interfaces• Singleton• Asynchronous calls• Cron-based Timer Service• Embeddable Container• EJB Lite
Cleveland Java Users Group – March '10 53535353
EJB 3.1• Packaging Simplification• No more ejb-jar, easier to share libraries,
persistence units• Singleton Beans
– @Singleton to share in EJB container (per JVM)• Concurrency
– @ReadOnly as singleton optimization (vs single-threaded)– @BeanManagedConcurrency for explicitly synchronized
• Time Service– @Schedule (hour=“12”, dayOfMonth=“2”)– Automatic creation (on deploy)
• Asynchronous Operations– @Asynchronous public void init …– @Asynchronous Future doWork …
Cleveland Java Users Group – March '10 54545454
// EJB 2.1public class PayrollBean implements javax.ejb.SessionBean {SessionContext ctx;DataSource empDB;public void setSessionContext(SessionContext ctx) { this.ctx = ctx;}public void ejbCreate() { Context initialContext =
new InitialContext(); empDB = (DataSource) initialContext.lookup(“java:comp/env/jdbc/empDB”);
}public void setBenefitsDeduction (
int empId, double deduction){ Connection conn = empDB.getConnection(); ...}public void ejbActivate() {}public void ejbPassivate() {}public void ejbRemove() {}...}
EJB 2.1 --> EJB 3.0 --> EJB 3.1
<session> <ejb-name>PayrollBean</ejb-name> <local-home>PayrollHome</local-home> <local>Payroll</local> <ejb-class>com.example.PayrollBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <resource-ref> <res-ref-name>jdbc/empDB</res-ref-name> <res-ref-type>javax.sql.DataSource</res-ref-type> <res-auth>Container</res-auth> </resource-ref></session>...<assembly-descriptor>...</assembly-descriptor>
Cleveland Java Users Group – March '10 55555555
EJB 3.0 --> EJB 3.1
// Same example, EJB 3.0
@Stateless public class PayrollBean implements Payroll {
@Resource DataSource empDB;public void setBenefitsDeduction (int empId, double deduction) { Connection conn = empDB.getConnection(); ...}
...}
Cleveland Java Users Group – March '10 56565656
EJB 3.1
• @Singleton beans• @Startup beans• @Asynchronous invocations• No interface view• Define EJBs directly inside a web
application• EJBContainer API works on Java SE
Cleveland Java Users Group – March '10 57575757
EJB 3.1: Singleton
• One single instance per application• Share state• @Singleton• Support for container-managed
concurrency and bean-managed concurrency– @ConcurrencyManagement
Cleveland Java Users Group – March '10 58585858
EJB 3.1: Embeddable Container
• API allowing to :– Initialize a container– Get container ctx
• Can run in any Java SE environment– Batch processing– Simplifies testing– Just a jar file in your classpath
Cleveland Java Users Group – March '10 59595959
Simplified PackagingAdding an EJB to a Web Application
BuyBooks.warBuyBooks.war ShoppingCartShoppingCartEJB ClassEJB Class
ShoppingCart.jarShoppingCart.jar
BuyBooks.earBuyBooks.ear
ShoppingCartShoppingCartEJB ClassEJB Class
BuyBooks.warBuyBooks.war
• EJB components can be packaged directly inside a web application archive (war file)
Cleveland Java Users Group – March '10 60606060
EJB 3.1 Lite
• A subset of EJB 3.1• All types of session beans
> stateful, stateless, singleton• Declarative transactions and security• Interceptors• ejb-jar.xml descriptor allowed (but
optional)
Cleveland Java Users Group – March '10 61616161
EJB Lite
• Subset of EJB 3.1– Local session bean– Injection– Transaction– Interceptors– Security
• Part of Web profile
• Not Included• Message Driven Beans• EJB Web Service• Endpoint• RMI/IIOP Interoperability• Remote interface• EJB 2.x• Timer service• CMP / BMP
Cleveland Java Users Group – March '10 62626262
JPA 2.0 Features
• Richer mappings• Richer JPQL• Pessimistic Locking• Criteria API• Cache API• Many more
Cleveland Java Users Group – March '10 63636363
JPA 2.0
• Support for collections of basic types and embeddable objects
• JPQL enhancements> e.g. CASE WHEN, NULLIF
• Pessimistic locking• Criteria API for dynamic query
construction
Cleveland Java Users Group – March '10 64646464
JPA 2.0: Richer Mapping
• Supports collection of basic types and embeddables– In JPA 1.0, only collections of entities were
supported• Supports multiple levels of embeddables• Embeddables containing collection of
embeddables and basic types• PK can be derived entities• More support for Maps...
Cleveland Java Users Group – March '10 65656565
JPA 2.0: Richer JPQL
• Added entity type to support non-polymorphic queries
• Allow joins in subquery FROM clause• Added new operators
– INDEX (for ordered lists)– CASE (for case expressions)– more
• Added new reserved words– ABS, BOTH, CONCAT, ELSE, END, ESCAPE,
LEADING, LENGTH, LOCATE, SET, SIZE, SQRT, SUBSTRING, TRAILING
Cleveland Java Users Group – March '10 66666666
JPA 2.0: Standard Properties
• In persistence.xml:– javax.persistence.jdbc.driver– javax.persistence.jdbc.url– javax.persistence.jdbc.user– javax.persistence.jdbc.password
Cleveland Java Users Group – March '10 67676767
JPA 2.0: Locking Enhancements
• JPA 1.0 supports only optimist locking• JPA 2.0 adds pessimistic locking• Multiple places to specify lock
– read and lock– read then lock– read then lock and refresh
public enum LockModeType {OPTIMISTIC,OPTIMISTIC_FORCE_INCREMENT,PESSIMISTIC,PESSIMISTIC_FORCE_INCREMENT,NONE
}
Cleveland Java Users Group – March '10 68686868
JPA 2.0: Criteria API
• Strongly typed criteria API• Object-based query definition objects
– rather than string-based• Like JPQL• Uses a metamodel – Compile time type
checking using Generics– Each entity X has a metamodel class X_– Criteria API operates on the metamodel
Cleveland Java Users Group – March '10 69696969
JPA 2.0: Caching
• Supports the use of a second-level cache
• Cache API– contain(Class, PK)– evict(Class, PK), evict(Class)– evictAll()
• @Cacheable annotation on entities
Cleveland Java Users Group – March '10 70707070
Servlet 3.0 Features
• Ease of Development– Through annotation
• Dynamic registration of Servlets and Filters– During runtime
• Pluggability (of 3rd-party frameworks/libs)– No more tweaking of web.xml is needed
• Asynchronous Servlet– Support Comet applications
• Security enhancements
Cleveland Java Users Group – March '10 71717171
Servlet Container Pluggability
• ServletContainerInitializer interface implemented by extensions
• @HandlesTypes to declare interest in one or more annotation types
• ServletContext now contains method to dynamically register servlets and filters
Cleveland Java Users Group – March '10 72727272
Asynchronous Servlet
• Async. Servlets are for preventing “thread starvation” in cases such as following in standard (thus portable) fashion– Waiting for resources (eg JDBC connection)– Waiting for Comet events (eg Published message
in Comet-based Chat application)– Waiting for responses (eg web services)
• Better scalability
Cleveland Java Users Group – March '10 73737373
Servlet Container Extension
Registered using META-INF/services
@HandlesTypes(WebService.class)public class WSInitializer implements ServletContainerInitializer { public void onStartup(Set<Class<?>> c, ServletContext ctx) { ServletRegistration r = ctx.addServlet(...); r.addServletMapping(...); }}
Cleveland Java Users Group – March '10 74747474
JSF 2.0
• Facelet as a standard view declaration language
• Composite components• Ajax (declarative and programmatic) f:ajax• Partial state saving• System events f:event• Resources• Validation f:validateBean
Cleveland Java Users Group – March '10 75757575
JSF 2.0: Composite Components
• Made up of simpler components• True JSF component• Much easier to build in JSF 2.0 (than in
JSF 1.0)– Single file, No Java code is needed– NetBeans 6.8 provides “Convert to
Composite Component” wizard• Can attach listeners, validators
Cleveland Java Users Group – March '10 76767676
JSF 2.0
• Annotation based– faces-config.xml is optional
• Easy navigation• Page description language
– Facelets (preferred)– JSP (still supported)
• Templating• Composite components• Ajax support
Cleveland Java Users Group – March '10 77777777
JSF 2.0: Facelets
• Preferred view handler in JSF– Addresses problems of using JSP with JSF
• XHTML• Pages are usable from HTML editors• Templating• Composite components
Cleveland Java Users Group – March '10 78787878
Modular Web Applications
• Libraries can contain a web-fragment.xml descriptor
• web.xml is now optional• Ability to serve resources out of jars
with /META-INF/resources
/WEB-INF/lib/catalog.jar /META-INF/resources/catalog/books.html
Cleveland Java Users Group – March '10 79797979
New JNDI Namespaces
• Until now, only java:comp• Now adding:
> java:module a module (war, ejb jar)> java:app an application> java:global the whole server / cluster
• Example @Resource(lookup=”java:app/CustomerDB”)
DataSource db;
• EJB components have global names now◸java:global/app1/module2/SomeBean!com.acme.Foo
Cleveland Java Users Group – March '10 80808080
Interceptors 1.1: What is it?
• Address cross-cutting concerns in Java EE• Was part of the EJB 3.0 spec• Now a separate spec shipped with EJB 3.1• Can be used in EJBs ... as well as
ManagedBeans• @AroundInvoke
Cleveland Java Users Group – March '10 81818181
Connectors 1.6
• Annotation-based programming model for resource adapters
• Generic work context> QoS across EIS
• Security contract for RAs
Cleveland Java Users Group – March '10 82828282
Java EE 6 Platform
• More powerful• More flexible• More extensible• Easier to use
http://java.sun.com/javaee
Cleveland Java Users Group – March '10 83838383
<Insert Picture Here>
Resources
Cleveland Java Users Group – March '10 84848484
Java EE 6 Tutorialhttps://www.sun.com/offers/docs/java_ee6_tutorial.pdf
• The Java EE 6 Tutorial, Volume II contains all the topics in Java EE 6 Tutorial, Volume I and adds advanced topics, additional technologies, and case studies.
• The document is available to registered users of Enterprise Server
• 732 pages
Cleveland Java Users Group – March '10 86868686
Java EE 6 Specification...
Cleveland Java Users Group – March '10 87878787
Java EE 6 Specification
Cleveland Java Users Group – March '10 88888888
Sample Query Using the Criteria API
Uses the canonical metamodel classesEntityManager em = ... ;CriteriaBuilder cb = em.getCriteriaBuilder();CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);Root<Employee> emp = cq.from(Employee.class);cq.select(emp);cq.where(cb.equal(emp.get(Employee_.lastName), "Smith"));TypedQuery<Employee> query = em.createQuery(cq);List<Employee> rows = query.getResultList();
Cleveland Java Users Group – March '10 89898989
Asynchronous HTTP Processing
• New programming model for async request processing> e.g. Comet, chat, push apps
• Opt-in model• Threads are managed by the container
@WebServlet(asyncSupported=true)public class MyServlet extends HttpServlet { ...}
Cleveland Java Users Group – March '10 90909090
Web Fragments in Servlet 3.0
META-INF/web-fragment.xml<web-fragment version=”3.0” xmlns="http://java.sun.com/xml/ns/javaee"> <servlet> <servlet-name>welcome</servlet-name> <servlet-class>WelcomeServlet</servlet-class> </servlet> <listener> <listener-class>RequestListener</listener-class> </listener></web-fragment>