Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems. And this is his blog!

Similar documents
Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems. And this is his blog!

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

DOC // JAVA TOMCAT WEB SERVICES TUTORIAL EBOOK

Lessons learned from real-world deployments of Java EE 7. Arun Gupta, Red

Java Platform, Enterprise Edition 6 with Extensible GlassFish Application Server v3

GlassFish Survival Guide. Alexis Moussine-Pouchkine GlassFish Team Sun Microsystems

<Insert Picture Here> Future<JavaEE>

Java EE 6 & GlassFish v3 Paving the path for future. Arun Gupta Sun Microsystems, Inc.

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Java Training Center, Noida - Java Expert Program

FILE - JAVA WEB SERVICE TUTORIAL

<Insert Picture Here> Oracle Public Cloud Powering Your Business Applications using The Java Cloud Service

ECLIPSE PERSISTENCE PLATFORM (ECLIPSELINK) FAQ

open source community experience distilled

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

"Web Age Speaks!" Webinar Series

Rails powered by GlassFish & jmaki

Eclipse Java Ejb 3.0 Tutorial For Beginners With Examples Pdf

EclipseLink. Solutions Guide for EclipseLink Release 2.6. June Beta Draft

Soap Based Web Services In Java Tutorial Eclipse Jboss

Migrating traditional Java EE applications to mobile

<Insert Picture Here> Java Virtual Developer Day

CO Java EE 7: Back-End Server Application Development

The Evolution of Java Persistence

Java One 2007 Conference Notes Juixe

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

Courses For Event Java Advanced Summer Training 2018

TIBCO Foresight Transaction Insight

JVA-563. Developing RESTful Services in Java

Oracle Developer Day

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

1 Markus Eisele, Insurance - Strategic IT-Architecture

SUN Sun Certified Enterprise Architect for J2EE 5. Download Full Version :

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java EE 7: Back-End Server Application Development

Hands-on Development of Web Applications with Java EE 6

INTRODUCTION TO COMPONENT DESIGN IN JAVA EE COMPONENT VS. OBJECT, JAVA EE JAVA EE DEMO. Tomas Cerny, Software Engineering, FEE, CTU in Prague,

Distributed Multitiered Application

Model Driven Development with EMF and EclipseLink (experiences in MDD and generating user interfaces)

WSO2 Platform Offerings for Developers

User s Guide 12c (12.2.1)

Apps Exception Problem Building Schema Jdeveloper

Tooling for Ajax-Based Development. Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc.

Oracle Mix. A Case Study. Ola Bini JRuby Core Developer ThoughtWorks Studios.

Performance evaluation of J2EE

Deccansoft Software Services. J2EE Syllabus

[EPUB] JAVA WEB SERVICES LAB MANUAL EBOOK

Etanova Enterprise Solutions

PDF SIMPLE JAVA WEB SERVICE EXAMPLE

Overview. Principal Product Manager Oracle JDeveloper & Oracle ADF

Webservices In Java Tutorial For Beginners Using Netbeans Pdf

Org.apache.derby.client.am.sqlexception Schem 'me' Does Not Exist

How To Get Database Schema In Java Using >>>CLICK HERE<<<

Oracle Fusion Middleware 11g: Build Applications with ADF I

Open Source Library Developer & IT Pro

ADF Code Corner. 70. How-to build dependent list boxes with Web Services Business Services. Abstract: twitter.com/adfcodecorner

Skyway Builder 6.3 Reference

Web Application Development Using JEE, Enterprise JavaBeans and JPA

<Insert Picture Here> JavaFX Overview April 2010

Contents at a Glance

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Example. Section: PS 709 Examples of Calculations of Reduced Hours of Work Last Revised: February 2017 Last Reviewed: February 2017 Next Review:

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

<Insert Picture Here> Productive JavaEE 5.0 Development

Liberty Right Fit for MicroProfile

Takes 2 to Tango: Java Web Services and.net Interoperability

Developing Cross Device Mobile Applications

Oracle Corporation

Sun Java System Application Server 8.1: Administration & Deployment

Improve and Expand JavaServer Faces Technology with JBoss Seam

Marketing Opportunities

Oracle 10g: Build J2EE Applications

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Via Giacomo Giovannetti Genova Sex M Birthday 26/10/1984 Citizenship Albanian

CBRN Data Import/Export Tool (CDIET) Presented by: Darius Munshi

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Open ESB v2, Open ESB.next and Project Fuji. Andreas Egloff Lead Architect SOA / Business Integration Sun Microsystems

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Polyglot Persistence. EclipseLink JPA for NoSQL, Relational, and Beyond. Shaun Smith Gunnar Wagenknecht

Developing Applications with Java EE 6 on WebLogic Server 12c

<Insert Picture Here> Upgrading from Oracle Application Server to Oracle WebLogic Server

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

<Insert Picture Here> Accelerated Java EE Development: The Oracle Way

Oracle Fusion Middleware 11g: Build Applications with ADF I

ORACLE WEBLOGIC SERVER 10g R3 ENTERPRISE EDITION

MicroProfile - New and Noteworthy

Java SE7 Fundamentals

DOWNLOAD OR READ : JAVA EE 6 WEB COMPONENT DEVELOPER CERTIFIED EXPERT MARATHON 1Z0 899 PRACTICE PROBLEMS PDF EBOOK EPUB MOBI

JCP 2.8 Progress Report Public EC Meeting. Heather VanCura 20 November 2012

The information system for the State Archives of the Ministry of Interior of the responsibilities

Oracle Corporation

RELEASE NOTES SHORETEL MS DYNAMICS CRM CLIENT VERSION 8

Hibernate Change Schema Name Runtime

Week 2 Unit 3: Creating a JDBC Application. January, 2015

GlassFish : From the clustering to the cloud. Fabien LEROY

ADF Mobile Code Corner

In this tutorial you will learn how to:

Oracle Enterprise Pack for Eclipse

Transcription:

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems. And this is his blog! Online Database Apps Made with ZohoCreator.100% Free Drag n Drop UI. Try Today! Creator.Zoho.Com/Online-DB-Apps Spring & Hibernate Replay New Feature: Record and Replay web apps replaysolutions.com Top 10 Enterprise CRM 2009 Top 10 Enterprise CRM Software Rankings. Download Free Report Now. Business-Software.com/BestCRM ««TOTD #111: Rails Scaffold for a pre-existing table using Oracle and GlassFish October 8, 2009 TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans Categories: frameworks, glassfish, javaee, netbeans, totd, webservices Edit This This Tip Of The Day explains how to expose an existing Oracle database table as a RESTful Web service endpoint using NetBeans tooling and deployed on GlassFish. Lets get started! 1. 2. Configure GlassFish v3 10/7 or a later nightly in a recent NetBeans 6.8 build (latest nightly). As issue# 9885 is fixed, so copy ojdbc6.jar in the "domains/domain1/lib/ext" directory. Create a Web application 1. Create a new "Web application" and name the project "RestfulOracle": 1 of 23 10/9/09 2:04 PM

click on "Next >". 2. Choose the newly added server and "Java EE 6 Web" as the Java EE version: 2 of 23 10/9/09 2:04 PM

and click on "Finish". 3. Create JPA entities for "HR" schema. The steps outlined below uses NetBeans solely for creating the JPA entities. Alternatively, TOTD #108 explains how to define a JDBC connection pool and JDBC resource using "asadmin" CLI and then use that resource from within NetBeans. Either way, the JDBC resource is stored in the underlying "domain.xml". 1. Right-click on the project and select "New", "Entity Classes from Database ". 2. In "Data Source:" select "New Data Source " as shown below: 3. Specify the JNDI name as "jdbc/hr" and choose the pre-configured database connection as shown below: 3 of 23 10/9/09 2:04 PM

TOTD #107 explains how to configure Oracle database in NetBeans. 4. In the list of "Available Tables:", select "EMPLOYEES" and click on "Add >" to see the following: 4 of 23 10/9/09 2:04 PM

Notice the list of related tables are included as well. Click on "Next >". 5. 6. Specify the package name as "model". Click on "Create Persistence Unit ", take the defaults, and click on "Create": 5 of 23 10/9/09 2:04 PM

and click on "Finish". Notice EclipseLink, the reference implementation for JPA 2.0, is used as the persistence provider. This generates POJOs that provide database access using JPA 2.0 APIs. These APIs are included as part of the Java EE 6 platform. 4. Create RESTful entities 1. Right-click on the project and select "RESTful Web Services from Entity Classes ": 6 of 23 10/9/09 2:04 PM

2. Select "Employees (model.employees)" from "Available Entity Classes:" and click on "Add >" to see the following: 7 of 23 10/9/09 2:04 PM

click on "Next >", take the defaults, and click on "Finish". This generates a bunch of wrapper classes using JAX-RS to expose the JPA Entity classes as RESTful Web services. JAX-RS 1.1 is also included as part of the Java EE 6 platform. 5. Run the Web service 1. Right-click the project and select "Test RESTful Web Services": 8 of 23 10/9/09 2:04 PM

This deploys the created Web application on the selected GlassFish build and displays the following page in the default browser: 9 of 23 10/9/09 2:04 PM

2. Click on "deparmentss" and then on "Test" button to see the output as: 10 of 23 10/9/09 2:04 PM

11 of 23 10/9/09 2:04 PM

Clicking the "Test" button issues a GET request to "http://localhost:8080/restfuloracle/resources/departmentss". This uses the generated JAX-RS wrapper classes to talk to the database using JPA entity classes and query the first 10 rows from the "DEPARTMENTS" table. The response is then JSON formatted using JAX-RS wrapper classes and is returned to the requesting page which then displays it nicely formatted in the table. It also shows l-level deep department s relationship to other entities. If the "expandlevel" on the above page is set to "0", then the following output is shown: 12 of 23 10/9/09 2:04 PM

13 of 23 10/9/09 2:04 PM

The "Raw View" (JSON data) of the original output looks like: Notice this is the raw JSON output generated by the JAX-RS wrapper classes. The "Http Monitor" traffic looks like: 14 of 23 10/9/09 2:04 PM

15 of 23 10/9/09 2:04 PM

The format of data returned can be changed from "application/json" to "application/xml" as shown below: And even a POST request can be generated. Do you have the need to expose your Oracle database tables as RESTful entities? A complete archive of all the TOTDs is available here. This and other similar applications will be demonstrated at the upcoming Oracle Open World. Technorati: totd oracle database glassfish v3 netbeans javaee jax-rs jpa rest Share and Enjoy: Related posts: 1. 2. 3. 4. 5. TOTD #107: Connect to Oracle database using NetBeans TOTD #108: Java EE 6 web application (JSF 2.0 + JPA 2.0 + EJB 3.1) using Oracle, NetBeans, and GlassFish RESTful representation of sakila using GlassFish and NetBeans IDE TOTD #25: Rails application with PostgreSQL database using NetBeans TOTD #106: How to install Oracle Database 10g on Mac OS X (Intel)? Comments (0) No Comments» 16 of 23 10/9/09 2:04 PM

No comments yet. RSS feed for comments on this post. TrackBack URL Leave a comment Logged in as arungupta. Log out» Submit Comment Pages: About speaking-credentials Search: 17 of 23 10/9/09 2:04 PM

Search Total published items: 988 Categories: general glassfish admin eclipse frameworks django grails javaee javaserverfaces jmaki rails sinatra wicket lotd netbeans screencast webservices personal photography running marathons totd Uncategorized web2.0 18 of 23 10/9/09 2:04 PM

Arun Gupta arungupta @ILoveNewDelhi It's not "the" national animal, it's the aquatic national animal. "The" national animal is still Tiger. 4 hours ago Join the conversation del.icio.us Troubleshooting a MacBook, MacBook Air or MacBook Pro that won't turn on 5 hours ago Developing RIA Web Applications with Oracle ADF 2009/10/08 GE2ORGE MAGGESSY: JDeveloper 11g on Mac OS 10.5 and above 2009/10/07 All-in-one Rails Server - RightScale Support 2009/10/01 JRuby on Rails: Deploying to Oracle Containers for Java EE (OC4J) - Oracle Wiki 2009/10/01 Archives: October 2009 September 2009 August 2009 19 of 23 10/9/09 2:04 PM

July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 20 of 23 10/9/09 2:04 PM

September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 September 2005 August 2005 Meta: Site Admin Log out RSS Comments RSS Valid XHTML XFN WP 21 of 23 10/9/09 2:04 PM

Technorati Widget Technorati authority 2 Search recent posts Technorati member Top tags» Member profile» Linking blogs admin eclipse galileo glassfish jax-ws lotd management monitoring netbeans persistence personal rails totd uncategorized webinar wicket clustering frameworks javaee javaserverfaces jersey jpa loadbalancing metro rest running v3 webservices 72 Blog reactions TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans Content available at: in Arun Gupta, Miles to go... TOTD #111: Rails Scaffold for a pre-existing table using Oracle and GlassFish Content available at: in Arun Gupta, Miles to go... TOTD #110: JRuby on Rails application using Oracle on GlassFish Content available at: in Arun Gupta, Miles to go... Favorites TOTD #112: Exposing 22 of 23 10/9/09 2:04 PM

Powered by WordPress 55608 visits from Sep 11, 2009 23 of 23 10/9/09 2:04 PM