https://wiki.eclipse.org/api.php?action=feedcontributions&user=Gul.onural.oracle.com&feedformat=atomEclipsepedia - User contributions [en]2024-03-19T03:58:16ZUser contributionsMediaWiki 1.26.4https://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS&diff=345378EclipseLink/Development/2.4.0/JPA-RS2013-08-08T16:09:32Z<p>Gul.onural.oracle.com: /* RESTFul API */</p>
<hr />
<div>= EclipseLink JPA-RS =<br />
{{bug|362900}}<br />
The EclipseLink 2.4.0 release will include an easy to use RESTful interface for interacting with JPA persistence units and EJB session bean methods. The intent is to provide an easy to use solution for exposing these Java EE capabilities through REST.<br />
<br />
'''Features'''<br />
* Simple Enablement: The JPA-RS capability can be easily added to any Java EE application being deployed to any compliant Java EE server by simply adding JPA-RS components to an application. <br />
* Zero configuration: When enabled the exposed JAX-RS service will allow any persistence unit or related EJB to be accessed using simple REST calls. Optional configuration will be supported for developers who want to limit what capabilities are exposed or wish to customize the resources used in any REST operation.<br />
* Dynamic JPA-RS: Enable the deployment of a generic JPA-RS application into a compliant Java EE server without requiring any included persistence units. This dynamic service will support provisioning of persistence units on the fly by passing in or providing reference to dynamic JPA configuration XML (persistence.xml and eclipselink-orm.xml using virtual entities).<br />
<br />
<div align="center"><br />
[[Image:JPA-RS.png]]<br />
</div><br />
== Requirements ==<br />
<br />
=== RESTFul API ===<br />
<br />
When enabled JPA-RS will expose the complete capabilities of the persistence units defined within the application.<br />
<br />
[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa.htm#CHDGHJID EclipseLink 2.4 REST API documentation]<br />
<br />
=== Persistence Unit Access ===<br />
<br />
In order for JPA-RS to access a persistence unit it must be made available through one of the following mechanisms:<br />
<br />
# Available on classpath of running JPA-RS instance so standard JPA bootstrapping can find it<br />
# Provisioned: This requires a PUT call to the service to inform it of a PU<br />
## Pass in all of the configuration<br />
## Pass in minimal information with information about where to retrieve additional config from<br />
<br />
== Using JPA-RS with static PU ==<br />
<br />
The goal is to make enabling of JPA-RS as easy to do as possible.<br />
<br />
=== JAX-RS ===<br />
<br />
In order to function in standard JAX-RS solution there must be annotated classes in the deployed WAR.<br />
<br />
=== Jersey ===<br />
<br />
The JAX-RS reference implementation is Jersey (jersey.java.net). Additional support will be added to leverage Jersey's (add version) planned support for defining JAX-RS applications and resources using their API. The goal here is to allow JPA-RS to be declaratively configured without requiring any additional code to be included in a user's WAR/EAR.<br />
<br />
== Dynamic JPA-RS ==<br />
<br />
Dynamic JPA-RS refers to the notion of a JPA-RS application deployment where persistence unit definitions are installed/provisioned on the fly.<br />
<br />
== Security ==<br />
<br />
Security in JPA-RS should be implemented through standard RESTful application security practices.<br />
<br />
The REST URLs described in the document linked above give an idea of which URLs could be restricted using a standard user/role based system. Some things to consider:<br />
<br />
<br />
* Simple CRUD operations are available at: <base>/{unit-name}/entity/{type}. Reads are GETs, and writes use PUT/POST/DELETE.<br />
* Queries can also Read, Update and Delete: <base>/{unit-name}/query/<queryName>. You will likely want similar restrictions on queries as other CRUD operations. Reads are GETs and writing queries are POST<br />
** Single result read queries are at: GET /persistence/{unit-name}/singleResultQuery/{name} and should likely be treated like other Read queries<br />
* Bootstrapping operations should likely be secured as they allow dynamic addition of mappings and persistence units. PUT/DELETE /persistence/{unit-name}<br />
* Metadata is available by Rest and may need securing: GET /persistence and GET /persistence/unitName<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
=== Additional URIs ===<br />
<br />
In addition to the URI's for all defined named queries and entity types there should be support in JPA-RS to access server side application logic within EJB session beans.<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
== Logging Configuration ==<br />
<br />
=== WebLogic Server ===<br />
<br />
*Create a logging.properties file (see the sample below).<br />
*Point WLS at logging.properties file with -Djava.util.logging.config.file=path/to/logging.properties, when starting server<br><br />
<br />
Sample logging.properties file<br />
<br />
<pre><br />
# Add handlers to the root logger.<br />
# These are inherited by all other loggers.<br />
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler<br />
<br />
#Set the default logging level for new ServerLoggingHandler instances<br />
weblogic.logging.ServerLoggingHandler.level = ALL<br />
<br />
# Set the logging level of the root logger.<br />
# Levels from lowest to highest are<br />
# FINEST, FINER, FINE, CONFIG, INFO, WARNING and SEVERE.<br />
# The default level for all loggers and handlers is INFO.<br />
.level=SEVERE<br />
<br />
# Specify logging levels for specific namespaces.<br />
org.eclipse.persistence.jpars.level=FINEST<br />
<br />
# Configure the ConsoleHandler.<br />
# ConsoleHandler uses java.util.logging.SimpleFormatter by default. <br />
# Even though the root logger has the same level as this,<br />
# the next line is still needed because we're configuring a handler,<br />
# not a logger, and handlers don't inherit properties from the root logger.<br />
java.util.logging.ConsoleHandler.level=FINEST<br />
<br />
# Configure the FileHandler.<br />
# FileHandler uses java.util.logging.XMLFormatter by default. <br />
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter<br />
java.util.logging.FileHandler.level=FINEST<br />
<br />
# The following special tokens can be used in the pattern property<br />
# which specifies the location and name of the log file.<br />
# / - standard path separator<br />
# %t - system temporary directory<br />
# %h - value of the user.home system property<br />
# %g - generation number for rotating logs<br />
# %u - unique number to avoid conflicts<br />
# FileHandler writes to %h/demo0.log by default.<br />
java.util.logging.FileHandler.pattern=./jpa-rs.log<br />
</pre><br />
<br />
=== Glassfish Server ===<br />
<br />
Using Glassfish Admin Console, add JPA-RS logger. The name of the JPA-RS logger is "org.eclipse.persistence.jpars". <br />
<br />
[[Image:gf_jpa_rs_log_config.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development&diff=338171EclipseLink/Development2013-05-29T17:34:55Z<p>Gul.onural.oracle.com: /* Current Development */</p>
<hr />
<div>__NOTOC__<br />
<table border="0" width="100%" cellspacing="6"> <br />
<tr><br />
<br />
<td valign="top"><br />
<table><br />
<tr><br />
<td><br />
=== Welcome to the <b>Eclipse Persistence Services Project (EclipseLink)</b> Development Home ===<br />
This page is focussed on information about current development and development process for the comitters of the EclipseLink project.<br />
</td><br />
</tr><br />
<br />
<tr><br />
<td valign="top"><br />
<table width="100%" cellpadding="0" cellspacing="0"><br />
<tr><br />
<td valign="top" style="background-color: #cff8d9; border-width: 1px; border-style: solid; border-color: #999999; padding: 10px;"><br />
== Current Development ==<br />
* Development has moved from SVN to Git, see [[EclipseLink/Development/Process/Git|Git]]<br />
<br />
* [[EclipseLink/Development/2.6.0]]<br />
* [[EclipseLink/Development/2.5.0]]<br />
** Looking for feedback on Proposals, Themes<br />
** Development being done in '''/git/master/'''<br />
<br />
* [[EclipseLink/Development/JPA 2.1]]<br />
** Outlines work for JPA 2.1 compliance based on EPD<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/trunk/'''<br />
<br />
* 2.2.1 Path Set<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/branches/2.2/trunk/'''<br />
<br />
* 2.1.1 Patch Set - '''Status: Proposed: Aug 2010'''<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/'''<br />
<br />
* 2.0.3 Patch Set - '''Status: Proposed: Fall , 2010'''<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/branches/2.0/trunk/''<br />
<br />
* 1.1.4 Patch Set - '''Status: Started, Release Date Not Scheduled'''<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/branches/1.1.0/trunk/'''<br />
<br />
* 1.2.1 Patch Set - '''Status: Not Scheduled'''<br />
** Development being done in '''/svnroot/rt/org.eclipse.persistence/branches/1.2/trunk/'''<br />
</td><br />
</tr><br />
<tr><br />
<td valign="top"><br />
=== Features, Bugs & Enhancements ===<br />
Features and Enhancements will have a BugZilla [[EclipseLink/Development/Bugs|enhancement]] associated with it. A functional specification and [[EclipseLink/Development/DesignDocs|design document]] will be created for each feature. A review of these docs will be initially done by mailing list (eclipselink-dev@eclipse.org) and by meeting if followup is required. Prior to code being checked in, code reviews will be done through the mailing list (eclipselink-dev@eclipse.org).<br />
<br />
Docs are usually not required for [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink bug] fixes. Prior to code being checked in, code reviews will be done through the mailing list (eclipselink-dev@eclipse.org).<br />
<br />
==== EclipseLink Newsgroups & Mailing Lists ====<br />
* [http://www.eclipse.org/forums/index.php?t=thread&frm_id=111 EclipseLink Users Forum]<br />
* [http://dev.eclipse.org/mhonarc/lists/eclipselink-dev/maillist.html EclipseLink Dev Mailing list - eclipse.org hosted - date view] - [http://dev.eclipse.org/mhonarc/lists/eclipselink-dev/ month view] - [https://dev.eclipse.org/mailman/listinfo/eclipselink-dev subscribe]<br />
* [http://dev.eclipse.org/mhonarc/lists/eclipselink-users/maillist.html EclipseLink Users Mailing list - eclipse.org hosted - date view] - [http://dev.eclipse.org/mhonarc/lists/eclipselink-users/ month view] - [https://dev.eclipse.org/mailman/listinfo/eclipselink-users subscribe]<br />
* [http://www.nabble.com/EclipseLink-f26430.html EclipseLink Nabble Forums] - [http://old.nabble.com/EclipseLink---Users-f26658.html users] - [http://old.nabble.com/EclipseLink---Dev-f26332.html dev]<br />
</td> <br />
</tr><br />
<br />
</table><br />
</td><br />
<br />
<td rowspan="3" width="310" valign="top"><br />
<table><br />
<tr><td style="background-color: #cff8d9; border-width: 1px; border-style: solid; border-color: #fabd23; padding: 10px;"><br />
'''Weekly Committer Meeting'''<br />
* [[EclipseLink/DevMeetings | Agenda]]<br />
* Thursday @ 11 AM EST (GMT -5)<br />
</td></tr><br />
<tr><td style="background-color: #bbbad2; border-width: 1px; border-style: solid; border-color: #fabd23; padding: 10px;"><br />
<br />
=== Links ===<br />
* [http://www.eclipse.org/eclipselink EclipseLink Home]<br />
* [http://www.eclipse.org/eclipselink/downloads/index.php Downloads]<br />
<br />
* [[EclipseLink/Bugs|Bugs and Enhancements]]<br />
* [[EclipseLink/Timeline | Project Timeline]]<br />
* [[EclipseLink/DevMeetings| Developer Meetings minutes and agendas]]<br />
* [[EclipseLink/Development/Summit|EclipseLink Summit 2010]]<br />
<br />
* [[/Testing|Testing]]<br />
* [[/Performance|Performance]]<br />
* [[EclipseLink/Development/Incubator|Incubator]] - where experimental ideas are developed <br />
* [[/Process|Development Process]] - overview of development process<br />
* [[EclipseLink/IPLog | IP Log]] - where all external contributions and new approved dependencies must be tracked<br />
* [[EclipseLink/Building| Building]] - building EclipseLink including Orbit projects<br />
* [[EclipseLink/Maven|Maven]] - information about EclipseLink Maven repository<br />
* [[EclipseLink/Development/Process/Git|Git]] - Git source repository<br />
* [[EclipseLink/Source|Source]] - links to source code<br />
====Resources====<br />
* [http://git.eclipse.org/c/eclipselink/eclipselink.runtime.git/ git.eclipse] - EclipseLink Git repository on Eclipse<br />
* [https://fisheye2.atlassian.com/changelog/eclipselinkgit FishEye] - graphical interface monitoring the Git repository<br />
* [https://www.ohloh.net/p/eclipselink Ohloh] - open source project network<br />
<br />
====Development Documentation====<br />
* [[EclipseLink/Dependencies|Dependencies]]<br />
* [[EclipseLink/Development/DesignDocs|Design documents]]<br />
* [[EclipseLink/Development/Architecture|Architecture documents]]<br />
* [[EclipseLink/Development/Documentation/Plans|End-user documentation plans]]<br />
====Wiki====<br />
* [[EclipseLink/WikiLayout|Wiki Organization]]<br />
* [[:Category:EclipseLink]]<br />
* [[:Category:EclipseLink:Users]]<br />
* [[:Category:EclipseLink:Committers]]<br />
<br />
</td></tr></table><br />
</td><br />
</tr><br />
</table><br />
<br />
[[Category:EclipseLink|Development]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/JPA-RS&diff=334996EclipseLink/Development/JPA-RS2013-04-25T14:09:43Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>__NOTOC__<br />
= EclipseLink JPA-RS Development =<br />
<br />
The EclipseLink 2.4.0 release introduced JPA-RS allowing developers to easily expose persistence units over REST (JAX-RS). The intent was to allow clients (HTML5/JS, Mobile, JavaSE/JavaFX) to easily access persistent data over REST with JSON or XML. This page tracks the ongoing feature development of JPA-RS including planned features for upcoming releases as well as a back-log of future enhancements. The details of each item will be tracked within its bug and associated wiki pages or documents.<br />
<br />
See the [http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG JPA-RS API Documentation version 2.4.0].<br />
<br />
== Project Planning ==<br />
<br />
See [https://bugs.eclipse.org/bugs/buglist.cgi?order=Importance&list_id=3106294&classification=RT&status_whiteboard_type=allwordssubstr&query_format=advanced&status_whiteboard=jpa-rs&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&product=EclipseLink BugDB] for a prioritized list of features and bugs along with their target releases.<br />
<br />
== Open Issues ==<br />
<br />
The following open issues have been recorded and not yet materialized as bugs. They represent items we should consider whether to document, and/or somehow address in code.<br />
<br />
*Bidirectional relationships and cycles - how do we pass bidirectional relationships in JSON/XML. There are limitations related to how you can expect to see responses in JSON/XML - e.g. XMLInverseReference needs to be specified somewhere for bidirecitonal relationships.<br><br />
*Can we remove the need for client to send the name of the attribute that makes up the opposite side of the relationship in the JPA-RS POST message ([[EclipseLink/Development/2.4.0/JPA-RS/REST-API#ADD]]) for adding a member to a collection and let the JAP-RS to figure it out on the server side ?<br><br />
* ManyToMany mappings are complex to map in JAXB. They will not marshall correctly in JPA-RS without being JAXB mapped with either annotations of xml<br />
* The REST API to setOrAddAttributes will not work when using FIELD access with Weaved Change Tracking and Internal Weaving, because there is no way to have EclipseLink set the value field and have changes tracked.<br />
* The REST API to create(PUT) will not set both sides of bidirectional(one-to-many, one-to-one) relationships.</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334342EclipseLink/Examples/JPARS/Simple2013-04-19T03:12:30Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp-incubation#.UXAta7WgKmA Maven Integration for Eclipse WTP] is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*[http://glassfish.java.net/ Glassfish 3.1.2.2]<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*javax.persistence.jar <br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.moxy.jar<br />
*org.eclipse.persistence.oracle.jar <br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/jpars/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. Right-click on the "student" project and select Maven -> Update Project..., then click OK.<br />
<br />
6. Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334310EclipseLink/Examples/JPARS/Simple2013-04-18T17:31:44Z<p>Gul.onural.oracle.com: /* Simple Example - student */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp-incubation#.UXAta7WgKmA Maven Integration for Eclipse WTP] is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*[http://glassfish.java.net/ Glassfish 3.1.2.2]<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334309EclipseLink/Examples/JPARS/Simple2013-04-18T17:31:16Z<p>Gul.onural.oracle.com: /* Simple Example - student */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp-incubation#.UXAta7WgKmA m2e] (Maven Integration for Eclipse WTP) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*[http://glassfish.java.net/ Glassfish 3.1.2.2]<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334005EclipseLink/Examples/JPARS/Simple2013-04-15T22:22:31Z<p>Gul.onural.oracle.com: /* Environment */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*[http://glassfish.java.net/ Glassfish 3.1.2.2]<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334004EclipseLink/Examples/JPARS/Simple2013-04-15T22:15:07Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2.2<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334003EclipseLink/Examples/JPARS/Simple2013-04-15T22:14:40Z<p>Gul.onural.oracle.com: /* Overview */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2.2<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using a GlassFish installation earlier than the [http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ latest promoted GlassFish 4.0], download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334002EclipseLink/Examples/JPARS/Simple2013-04-15T22:14:17Z<p>Gul.onural.oracle.com: /* Environment */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2.2<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using a GlassFish installation earlier than the [http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ latest promoted GlassFish 4.0], download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=334001EclipseLink/Examples/JPARS/Simple2013-04-15T22:14:03Z<p>Gul.onural.oracle.com: /* Environment */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2<br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using a GlassFish installation earlier than the [http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ latest promoted GlassFish 4.0], download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333874EclipseLink/Examples/JPARS/Simple2013-04-13T15:50:52Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using a GlassFish installation earlier than the [http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ latest promoted GlassFish 4.0], download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333873EclipseLink/Examples/JPARS/Simple2013-04-13T15:50:19Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using a GlassFish installation earlier than [http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ the latest promoted GlassFish 4.0], download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=User:Gul.onural.oracle.com&diff=333870User:Gul.onural.oracle.com2013-04-13T05:46:27Z<p>Gul.onural.oracle.com: /* Location */</p>
<hr />
<div>=Gul Onural=<br />
'''bugzilla id''': gul.onural@oracle.com<br />
<br />
'''comitter id''': gonural<br />
<br />
'''projects''': Eclipse Persistence Services ([[EclipseLink]])<br />
<br />
===Location===<br />
Ottawa, Canada - Eastern Standard Time<br />
<br />
===Profession===<br />
Software Developer<br />
<br />
Currently working for [http://www.oracle.com Oracle Corporation] on [http://www.oracle.com/technology/products/ias/toplink/ TopLink].<br />
<br />
Also working with Eclipse Foundation on [[EclipseLink]].<br />
<br />
[[Category:Users|Onural, Gul]]<br />
[[Category:Committers|Onural, Gul]]<br />
[[Category:EclipseLink:Users|Onural, Gul]]<br />
[[Category:EclipseLink:Committers|Onural, Gul]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=User:Gul.onural.oracle.com&diff=333869User:Gul.onural.oracle.com2013-04-13T05:44:07Z<p>Gul.onural.oracle.com: /* Gul Onural */</p>
<hr />
<div>=Gul Onural=<br />
'''bugzilla id''': gul.onural@oracle.com<br />
<br />
'''comitter id''': gonural<br />
<br />
'''projects''': Eclipse Persistence Services ([[EclipseLink]])<br />
<br />
===Location===<br />
Ottawa, Canada<br />
<br />
===Profession===<br />
Software Developer<br />
<br />
Currently working for [http://www.oracle.com Oracle Corporation] on [http://www.oracle.com/technology/products/ias/toplink/ TopLink].<br />
<br />
Also working with Eclipse Foundation on [[EclipseLink]].<br />
<br />
[[Category:Users|Onural, Gul]]<br />
[[Category:Committers|Onural, Gul]]<br />
[[Category:EclipseLink:Users|Onural, Gul]]<br />
[[Category:EclipseLink:Committers|Onural, Gul]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=User:Gul.onural.oracle.com&diff=333868User:Gul.onural.oracle.com2013-04-13T05:40:32Z<p>Gul.onural.oracle.com: New page: =Gul Onural= bugzilla id: gul.onural@oracle.com comitter id: gonural projects: Eclipse Persistence Services (EclipseLink) ===Location=== Ottawa, Canada ===Profession=== Software De...</p>
<hr />
<div>=Gul Onural=<br />
bugzilla id: gul.onural@oracle.com<br />
<br />
comitter id: gonural<br />
<br />
projects: Eclipse Persistence Services ([[EclipseLink]])<br />
<br />
===Location===<br />
Ottawa, Canada<br />
<br />
===Profession===<br />
Software Developer<br />
<br />
Currently working for [http://www.oracle.com Oracle Corporation] on [http://www.oracle.com/technology/products/ias/toplink/ TopLink].<br />
<br />
Also working with Eclipse Foundation on [[EclipseLink]].<br />
<br />
[[Category:Users|Onural, Gul]]<br />
[[Category:Committers|Onural, Gul]]<br />
[[Category:EclipseLink:Users|Onural, Gul]]<br />
[[Category:EclipseLink:Committers|Onural, Gul]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333867EclipseLink/Examples/JPARS/Simple2013-04-13T05:32:43Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Builds] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333866EclipseLink/Examples/JPARS/Simple2013-04-13T05:21:04Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from [http://www.eclipse.org/eclipselink/downloads/nightly.php 2.4.2 Nightly Build Results] and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333865EclipseLink/Examples/JPARS/Simple2013-04-13T05:15:05Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
*org.eclipse.persistence.moxy.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333864EclipseLink/Examples/JPARS/Simple2013-04-13T05:11:55Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. Download EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded : <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS&diff=333863EclipseLink/Development/2.4.0/JPA-RS2013-04-13T01:30:30Z<p>Gul.onural.oracle.com: /* RESTFul API */</p>
<hr />
<div>= EclipseLink JPA-RS =<br />
{{bug|362900}}<br />
The EclipseLink 2.4.0 release will include an easy to use RESTful interface for interacting with JPA persistence units and EJB session bean methods. The intent is to provide an easy to use solution for exposing these Java EE capabilities through REST.<br />
<br />
'''Features'''<br />
* Simple Enablement: The JPA-RS capability can be easily added to any Java EE application being deployed to any compliant Java EE server by simply adding JPA-RS components to an application. <br />
* Zero configuration: When enabled the exposed JAX-RS service will allow any persistence unit or related EJB to be accessed using simple REST calls. Optional configuration will be supported for developers who want to limit what capabilities are exposed or wish to customize the resources used in any REST operation.<br />
* Dynamic JPA-RS: Enable the deployment of a generic JPA-RS application into a compliant Java EE server without requiring any included persistence units. This dynamic service will support provisioning of persistence units on the fly by passing in or providing reference to dynamic JPA configuration XML (persistence.xml and eclipselink-orm.xml using virtual entities).<br />
<br />
<div align="center"><br />
[[Image:JPA-RS.png]]<br />
</div><br />
== Requirements ==<br />
<br />
=== RESTFul API ===<br />
<br />
When enabled JPA-RS will expose the complete capabilities of the persistence units defined within the application.<br />
<br />
[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG EclipseLink 2.4 REST API documentation]<br />
<br />
=== Persistence Unit Access ===<br />
<br />
In order for JPA-RS to access a persistence unit it must be made available through one of the following mechanisms:<br />
<br />
# Available on classpath of running JPA-RS instance so standard JPA bootstrapping can find it<br />
# Provisioned: This requires a PUT call to the service to inform it of a PU<br />
## Pass in all of the configuration<br />
## Pass in minimal information with information about where to retrieve additional config from<br />
<br />
== Using JPA-RS with static PU ==<br />
<br />
The goal is to make enabling of JPA-RS as easy to do as possible.<br />
<br />
=== JAX-RS ===<br />
<br />
In order to function in standard JAX-RS solution there must be annotated classes in the deployed WAR.<br />
<br />
=== Jersey ===<br />
<br />
The JAX-RS reference implementation is Jersey (jersey.java.net). Additional support will be added to leverage Jersey's (add version) planned support for defining JAX-RS applications and resources using their API. The goal here is to allow JPA-RS to be declaratively configured without requiring any additional code to be included in a user's WAR/EAR.<br />
<br />
== Dynamic JPA-RS ==<br />
<br />
Dynamic JPA-RS refers to the notion of a JPA-RS application deployment where persistence unit definitions are installed/provisioned on the fly.<br />
<br />
== Security ==<br />
<br />
Security in JPA-RS should be implemented through standard RESTful application security practices.<br />
<br />
The REST URLs described in the document linked above give an idea of which URLs could be restricted using a standard user/role based system. Some things to consider:<br />
<br />
<br />
* Simple CRUD operations are available at: <base>/{unit-name}/entity/{type}. Reads are GETs, and writes use PUT/POST/DELETE.<br />
* Queries can also Read, Update and Delete: <base>/{unit-name}/query/<queryName>. You will likely want similar restrictions on queries as other CRUD operations. Reads are GETs and writing queries are POST<br />
** Single result read queries are at: GET /persistence/{unit-name}/singleResultQuery/{name} and should likely be treated like other Read queries<br />
* Bootstrapping operations should likely be secured as they allow dynamic addition of mappings and persistence units. PUT/DELETE /persistence/{unit-name}<br />
* Metadata is available by Rest and may need securing: GET /persistence and GET /persistence/unitName<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
=== Additional URIs ===<br />
<br />
In addition to the URI's for all defined named queries and entity types there should be support in JPA-RS to access server side application logic within EJB session beans.<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
== Logging Configuration ==<br />
<br />
=== WebLogic Server ===<br />
<br />
*Create a logging.properties file (see the sample below).<br />
*Point WLS at logging.properties file with -Djava.util.logging.config.file=path/to/logging.properties, when starting server<br><br />
<br />
Sample logging.properties file<br />
<br />
<pre><br />
# Add handlers to the root logger.<br />
# These are inherited by all other loggers.<br />
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler<br />
<br />
#Set the default logging level for new ServerLoggingHandler instances<br />
weblogic.logging.ServerLoggingHandler.level = ALL<br />
<br />
# Set the logging level of the root logger.<br />
# Levels from lowest to highest are<br />
# FINEST, FINER, FINE, CONFIG, INFO, WARNING and SEVERE.<br />
# The default level for all loggers and handlers is INFO.<br />
.level=SEVERE<br />
<br />
# Specify logging levels for specific namespaces.<br />
org.eclipse.persistence.jpars.level=FINEST<br />
<br />
# Configure the ConsoleHandler.<br />
# ConsoleHandler uses java.util.logging.SimpleFormatter by default. <br />
# Even though the root logger has the same level as this,<br />
# the next line is still needed because we're configuring a handler,<br />
# not a logger, and handlers don't inherit properties from the root logger.<br />
java.util.logging.ConsoleHandler.level=FINEST<br />
<br />
# Configure the FileHandler.<br />
# FileHandler uses java.util.logging.XMLFormatter by default. <br />
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter<br />
java.util.logging.FileHandler.level=FINEST<br />
<br />
# The following special tokens can be used in the pattern property<br />
# which specifies the location and name of the log file.<br />
# / - standard path separator<br />
# %t - system temporary directory<br />
# %h - value of the user.home system property<br />
# %g - generation number for rotating logs<br />
# %u - unique number to avoid conflicts<br />
# FileHandler writes to %h/demo0.log by default.<br />
java.util.logging.FileHandler.pattern=./jpa-rs.log<br />
</pre><br />
<br />
=== Glassfish Server ===<br />
<br />
Using Glassfish Admin Console, add JPA-RS logger. The name of the JPA-RS logger is "org.eclipse.persistence.jpars". <br />
<br />
[[Image:gf_jpa_rs_log_config.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS&diff=333862EclipseLink/Development/2.4.0/JPA-RS2013-04-13T01:27:13Z<p>Gul.onural.oracle.com: /* RESTFul API */</p>
<hr />
<div>= EclipseLink JPA-RS =<br />
{{bug|362900}}<br />
The EclipseLink 2.4.0 release will include an easy to use RESTful interface for interacting with JPA persistence units and EJB session bean methods. The intent is to provide an easy to use solution for exposing these Java EE capabilities through REST.<br />
<br />
'''Features'''<br />
* Simple Enablement: The JPA-RS capability can be easily added to any Java EE application being deployed to any compliant Java EE server by simply adding JPA-RS components to an application. <br />
* Zero configuration: When enabled the exposed JAX-RS service will allow any persistence unit or related EJB to be accessed using simple REST calls. Optional configuration will be supported for developers who want to limit what capabilities are exposed or wish to customize the resources used in any REST operation.<br />
* Dynamic JPA-RS: Enable the deployment of a generic JPA-RS application into a compliant Java EE server without requiring any included persistence units. This dynamic service will support provisioning of persistence units on the fly by passing in or providing reference to dynamic JPA configuration XML (persistence.xml and eclipselink-orm.xml using virtual entities).<br />
<br />
<div align="center"><br />
[[Image:JPA-RS.png]]<br />
</div><br />
== Requirements ==<br />
<br />
=== RESTFul API ===<br />
<br />
When enabled JPA-RS will expose the complete capabilities of the persistence units defined within the application.<br />
<br />
[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG JPA-RS API (EclipseLink 2.4.0)]<br />
<br />
=== Persistence Unit Access ===<br />
<br />
In order for JPA-RS to access a persistence unit it must be made available through one of the following mechanisms:<br />
<br />
# Available on classpath of running JPA-RS instance so standard JPA bootstrapping can find it<br />
# Provisioned: This requires a PUT call to the service to inform it of a PU<br />
## Pass in all of the configuration<br />
## Pass in minimal information with information about where to retrieve additional config from<br />
<br />
== Using JPA-RS with static PU ==<br />
<br />
The goal is to make enabling of JPA-RS as easy to do as possible.<br />
<br />
=== JAX-RS ===<br />
<br />
In order to function in standard JAX-RS solution there must be annotated classes in the deployed WAR.<br />
<br />
=== Jersey ===<br />
<br />
The JAX-RS reference implementation is Jersey (jersey.java.net). Additional support will be added to leverage Jersey's (add version) planned support for defining JAX-RS applications and resources using their API. The goal here is to allow JPA-RS to be declaratively configured without requiring any additional code to be included in a user's WAR/EAR.<br />
<br />
== Dynamic JPA-RS ==<br />
<br />
Dynamic JPA-RS refers to the notion of a JPA-RS application deployment where persistence unit definitions are installed/provisioned on the fly.<br />
<br />
== Security ==<br />
<br />
Security in JPA-RS should be implemented through standard RESTful application security practices.<br />
<br />
The REST URLs described in the document linked above give an idea of which URLs could be restricted using a standard user/role based system. Some things to consider:<br />
<br />
<br />
* Simple CRUD operations are available at: <base>/{unit-name}/entity/{type}. Reads are GETs, and writes use PUT/POST/DELETE.<br />
* Queries can also Read, Update and Delete: <base>/{unit-name}/query/<queryName>. You will likely want similar restrictions on queries as other CRUD operations. Reads are GETs and writing queries are POST<br />
** Single result read queries are at: GET /persistence/{unit-name}/singleResultQuery/{name} and should likely be treated like other Read queries<br />
* Bootstrapping operations should likely be secured as they allow dynamic addition of mappings and persistence units. PUT/DELETE /persistence/{unit-name}<br />
* Metadata is available by Rest and may need securing: GET /persistence and GET /persistence/unitName<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
=== Additional URIs ===<br />
<br />
In addition to the URI's for all defined named queries and entity types there should be support in JPA-RS to access server side application logic within EJB session beans.<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
== Logging Configuration ==<br />
<br />
=== WebLogic Server ===<br />
<br />
*Create a logging.properties file (see the sample below).<br />
*Point WLS at logging.properties file with -Djava.util.logging.config.file=path/to/logging.properties, when starting server<br><br />
<br />
Sample logging.properties file<br />
<br />
<pre><br />
# Add handlers to the root logger.<br />
# These are inherited by all other loggers.<br />
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler<br />
<br />
#Set the default logging level for new ServerLoggingHandler instances<br />
weblogic.logging.ServerLoggingHandler.level = ALL<br />
<br />
# Set the logging level of the root logger.<br />
# Levels from lowest to highest are<br />
# FINEST, FINER, FINE, CONFIG, INFO, WARNING and SEVERE.<br />
# The default level for all loggers and handlers is INFO.<br />
.level=SEVERE<br />
<br />
# Specify logging levels for specific namespaces.<br />
org.eclipse.persistence.jpars.level=FINEST<br />
<br />
# Configure the ConsoleHandler.<br />
# ConsoleHandler uses java.util.logging.SimpleFormatter by default. <br />
# Even though the root logger has the same level as this,<br />
# the next line is still needed because we're configuring a handler,<br />
# not a logger, and handlers don't inherit properties from the root logger.<br />
java.util.logging.ConsoleHandler.level=FINEST<br />
<br />
# Configure the FileHandler.<br />
# FileHandler uses java.util.logging.XMLFormatter by default. <br />
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter<br />
java.util.logging.FileHandler.level=FINEST<br />
<br />
# The following special tokens can be used in the pattern property<br />
# which specifies the location and name of the log file.<br />
# / - standard path separator<br />
# %t - system temporary directory<br />
# %h - value of the user.home system property<br />
# %g - generation number for rotating logs<br />
# %u - unique number to avoid conflicts<br />
# FileHandler writes to %h/demo0.log by default.<br />
java.util.logging.FileHandler.pattern=./jpa-rs.log<br />
</pre><br />
<br />
=== Glassfish Server ===<br />
<br />
Using Glassfish Admin Console, add JPA-RS logger. The name of the JPA-RS logger is "org.eclipse.persistence.jpars". <br />
<br />
[[Image:gf_jpa_rs_log_config.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333837EclipseLink/Examples/JPARS/Simple2013-04-12T15:44:28Z<p>Gul.onural.oracle.com: /* Running the Example */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. HTTP requests can also contain Content-Type headers. With POST or PUT requests, the client actually sends a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json. <br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333835EclipseLink/Examples/JPARS/Simple2013-04-12T15:41:49Z<p>Gul.onural.oracle.com: /* Running the Example */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman. Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json.<br />
<br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333834EclipseLink/Examples/JPARS/Simple2013-04-12T15:39:34Z<p>Gul.onural.oracle.com: /* Running the Example */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
<br />
Note : Please see [https://github.com/a85/POSTMan-Chrome-Extension/wiki/Creating-and-sending-requests Creating and sending requests using Postman] if you are not familiar with creating and sending REST request using Postman. If you are using another tool to construct REST requests, please make sure you set [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 Accept header] correctly. The JPA-RS accepts "application/json" and "application/xml" and this example focuses on json.<br />
<br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333345EclipseLink/Examples/JPARS/Simple2013-04-09T21:11:03Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. If you don't see GlassFish listed in available server types, click "Download additional server adapters" and select Oracle Glassfish Server Tools to install GlassFish server adapter. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333344EclipseLink/Examples/JPARS/Simple2013-04-09T21:08:19Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. Click "new server wizard" link on the Servers tab. Click "Download additional server adapters" to install GlassFish server adapter if you don't see GlassFish listed in available server types. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333343EclipseLink/Examples/JPARS/Simple2013-04-09T21:06:37Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. Click "Download additional server adapters" to install GlassFish server adapter if you don't have it in list of server types. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2. <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333342EclipseLink/Examples/JPARS/Simple2013-04-09T21:02:20Z<p>Gul.onural.oracle.com: /* Simple Example - student */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release, make sure [http://www.eclipse.org/m2e/download/ m2e] (the maven integration for Eclipse) is installed. <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333340EclipseLink/Examples/JPARS/Simple2013-04-09T20:54:12Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br />
Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. <br />
Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333339EclipseLink/Examples/JPARS/Simple2013-04-09T20:53:21Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. Use "Additional Properties" (shown below) tab to define database URL, User and Password (and other mandatory properties that the database you use might require). <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333338EclipseLink/Examples/JPARS/Simple2013-04-09T20:51:56Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext. Use "Additional Properties" tab to define database URL, User and Password. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333336EclipseLink/Examples/JPARS/Simple2013-04-09T20:48:27Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. Your database driver should be place under $GLASSFISH_HOME/glassfish/domains/<your_domain_folder>/lib/ext <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333335EclipseLink/Examples/JPARS/Simple2013-04-09T20:44:55Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level, so configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333334EclipseLink/Examples/JPARS/Simple2013-04-09T20:44:16Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level. So configure the logger to FINER or FINEST. Use Glassfish Admin Console-> Configurations-> default-config-> Logger Settings-> Log Levels tab -> Add Logger to add a logger for the JPA-RS. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS&diff=333332EclipseLink/Development/2.4.0/JPA-RS2013-04-09T20:36:56Z<p>Gul.onural.oracle.com: /* Security */</p>
<hr />
<div>= EclipseLink JPA-RS =<br />
{{bug|362900}}<br />
The EclipseLink 2.4.0 release will include an easy to use RESTful interface for interacting with JPA persistence units and EJB session bean methods. The intent is to provide an easy to use solution for exposing these Java EE capabilities through REST.<br />
<br />
'''Features'''<br />
* Simple Enablement: The JPA-RS capability can be easily added to any Java EE application being deployed to any compliant Java EE server by simply adding JPA-RS components to an application. <br />
* Zero configuration: When enabled the exposed JAX-RS service will allow any persistence unit or related EJB to be accessed using simple REST calls. Optional configuration will be supported for developers who want to limit what capabilities are exposed or wish to customize the resources used in any REST operation.<br />
* Dynamic JPA-RS: Enable the deployment of a generic JPA-RS application into a compliant Java EE server without requiring any included persistence units. This dynamic service will support provisioning of persistence units on the fly by passing in or providing reference to dynamic JPA configuration XML (persistence.xml and eclipselink-orm.xml using virtual entities).<br />
<br />
<div align="center"><br />
[[Image:JPA-RS.png]]<br />
</div><br />
== Requirements ==<br />
<br />
=== RESTFul API ===<br />
<br />
When enabled JPA-RS will expose the complete capabilities of the persistence units defined within the application.<br />
<br />
[[EclipseLink/Development/2.4.0/JPA-RS/REST-API]]<br />
<br />
=== Persistence Unit Access ===<br />
<br />
In order for JPA-RS to access a persistence unit it must be made available through one of the following mechanisms:<br />
<br />
# Available on classpath of running JPA-RS instance so standard JPA bootstrapping can find it<br />
# Provisioned: This requires a PUT call to the service to inform it of a PU<br />
## Pass in all of the configuration<br />
## Pass in minimal information with information about where to retrieve additional config from<br />
<br />
== Using JPA-RS with static PU ==<br />
<br />
The goal is to make enabling of JPA-RS as easy to do as possible.<br />
<br />
=== JAX-RS ===<br />
<br />
In order to function in standard JAX-RS solution there must be annotated classes in the deployed WAR.<br />
<br />
=== Jersey ===<br />
<br />
The JAX-RS reference implementation is Jersey (jersey.java.net). Additional support will be added to leverage Jersey's (add version) planned support for defining JAX-RS applications and resources using their API. The goal here is to allow JPA-RS to be declaratively configured without requiring any additional code to be included in a user's WAR/EAR.<br />
<br />
== Dynamic JPA-RS ==<br />
<br />
Dynamic JPA-RS refers to the notion of a JPA-RS application deployment where persistence unit definitions are installed/provisioned on the fly.<br />
<br />
== Security ==<br />
<br />
Security in JPA-RS should be implemented through standard RESTful application security practices.<br />
<br />
The REST URLs described in the document linked above give an idea of which URLs could be restricted using a standard user/role based system. Some things to consider:<br />
<br />
<br />
* Simple CRUD operations are available at: <base>/{unit-name}/entity/{type}. Reads are GETs, and writes use PUT/POST/DELETE.<br />
* Queries can also Read, Update and Delete: <base>/{unit-name}/query/<queryName>. You will likely want similar restrictions on queries as other CRUD operations. Reads are GETs and writing queries are POST<br />
** Single result read queries are at: GET /persistence/{unit-name}/singleResultQuery/{name} and should likely be treated like other Read queries<br />
* Bootstrapping operations should likely be secured as they allow dynamic addition of mappings and persistence units. PUT/DELETE /persistence/{unit-name}<br />
* Metadata is available by Rest and may need securing: GET /persistence and GET /persistence/unitName<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
=== Additional URIs ===<br />
<br />
In addition to the URI's for all defined named queries and entity types there should be support in JPA-RS to access server side application logic within EJB session beans.<br />
<br />
== Configurable Content ==<br />
<br />
By default all entity types CRUD operations and named queries will be exposed by JPA-RS. Configuration of which URLs are available is through the security policy described above.<br />
<br />
== Logging Configuration ==<br />
<br />
=== WebLogic Server ===<br />
<br />
*Create a logging.properties file (see the sample below).<br />
*Point WLS at logging.properties file with -Djava.util.logging.config.file=path/to/logging.properties, when starting server<br><br />
<br />
Sample logging.properties file<br />
<br />
<pre><br />
# Add handlers to the root logger.<br />
# These are inherited by all other loggers.<br />
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler<br />
<br />
#Set the default logging level for new ServerLoggingHandler instances<br />
weblogic.logging.ServerLoggingHandler.level = ALL<br />
<br />
# Set the logging level of the root logger.<br />
# Levels from lowest to highest are<br />
# FINEST, FINER, FINE, CONFIG, INFO, WARNING and SEVERE.<br />
# The default level for all loggers and handlers is INFO.<br />
.level=SEVERE<br />
<br />
# Specify logging levels for specific namespaces.<br />
org.eclipse.persistence.jpars.level=FINEST<br />
<br />
# Configure the ConsoleHandler.<br />
# ConsoleHandler uses java.util.logging.SimpleFormatter by default. <br />
# Even though the root logger has the same level as this,<br />
# the next line is still needed because we're configuring a handler,<br />
# not a logger, and handlers don't inherit properties from the root logger.<br />
java.util.logging.ConsoleHandler.level=FINEST<br />
<br />
# Configure the FileHandler.<br />
# FileHandler uses java.util.logging.XMLFormatter by default. <br />
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter<br />
java.util.logging.FileHandler.level=FINEST<br />
<br />
# The following special tokens can be used in the pattern property<br />
# which specifies the location and name of the log file.<br />
# / - standard path separator<br />
# %t - system temporary directory<br />
# %h - value of the user.home system property<br />
# %g - generation number for rotating logs<br />
# %u - unique number to avoid conflicts<br />
# FileHandler writes to %h/demo0.log by default.<br />
java.util.logging.FileHandler.pattern=./jpa-rs.log<br />
</pre><br />
<br />
=== Glassfish Server ===<br />
<br />
Using Glassfish Admin Console, add JPA-RS logger. The name of the JPA-RS logger is "org.eclipse.persistence.jpars". <br />
<br />
[[Image:gf_jpa_rs_log_config.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333331EclipseLink/Examples/JPARS/Simple2013-04-09T19:56:05Z<p>Gul.onural.oracle.com: /* Installation and Configuration */</p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
*org.eclipse.persistence.jpa.jpql.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level. So configure the logger to FINER or FINEST. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS/REST-API&diff=333300EclipseLink/Development/2.4.0/JPA-RS/REST-API2013-04-09T14:22:39Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG JPA-RS API Documentation version 2.4.0]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS/REST-API&diff=333299EclipseLink/Development/2.4.0/JPA-RS/REST-API2013-04-09T14:21:57Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG JPA-RS API Reference version 2.4.0]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS/REST-API&diff=333298EclipseLink/Development/2.4.0/JPA-RS/REST-API2013-04-09T14:21:36Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG JPA-RS API Reference]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Development/2.4.0/JPA-RS/REST-API&diff=333297EclipseLink/Development/2.4.0/JPA-RS/REST-API2013-04-09T14:20:36Z<p>Gul.onural.oracle.com: Replacing page with '
[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG]'</p>
<hr />
<div><br />
[http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa003.htm#CHDEGJIG]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333150EclipseLink/Examples/JPARS/Simple2013-04-08T15:49:50Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish. <br />
<br />
<br> <br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are logged at "FINER" log level. So configure the logger to FINER or FINEST. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333149EclipseLink/Examples/JPARS/Simple2013-04-08T15:49:23Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> <br />
<br />
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\&lt;your_domain&gt;\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish.<br />
<br />
<br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are at "FINER" log level. So configure the logger to FINER or FINEST. <br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333122EclipseLink/Examples/JPARS/Simple2013-04-08T14:36:42Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br />
<br />
Note: If you want to see JPA-RS logs, add a logger for "'''''org.eclipse.persistence.jpars'''''". Currently exceptions are at "FINER" log level. So configure the logger to FINER or FINEST.<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333118EclipseLink/Examples/JPARS/Simple2013-04-08T14:29:32Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333116EclipseLink/Examples/JPARS/Simple2013-04-08T14:28:57Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from&nbsp;&nbsp;http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results&nbsp;)and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333114EclipseLink/Examples/JPARS/Simple2013-04-08T14:27:19Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from http://www.eclipse.org/eclipselink/downloads/nightly.php and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333094EclipseLink/Examples/JPARS/Simple2013-04-08T13:51:10Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Install Glassfish 3.1.2.2 or later&nbsp;<br />
#*Check out student example from GIT<br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink binaries from http://www.eclipse.org/eclipselink/downloads/. Choose OSGI bundles from the available downloads. Replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar <br />
*org.eclipse.persistence.jpa.jar <br />
*org.eclipse.persistence.asm.jar <br />
*org.eclipse.persistence.jpa.modelgen.jar <br />
*org.eclipse.persistence.core.jar <br />
*org.eclipse.persistence.oracle.jar <br />
*javax.persistence.jar <br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp; <br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333092EclipseLink/Examples/JPARS/Simple2013-04-08T13:48:09Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div> <br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS|JPA-RS]] with a single entity persistence unit in a web application. <br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example. <br />
<br />
*EclipseLink 2.4.2 <br />
*Eclipse Java EE IDE - Juno Release <br />
*Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below. <br />
*Glassfish 3.1.2 or later <br />
*REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Check out student example from GIT <br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity <br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span> <br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish installation earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink binaries from http://www.eclipse.org/eclipselink/downloads/. Choose OSGI bundles from the available downloads. Replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above: <br />
<br />
*org.eclipse.persistence.antlr.jar<br />
*org.eclipse.persistence.jpa.jar<br />
*org.eclipse.persistence.asm.jar<br />
*org.eclipse.persistence.jpa.modelgen.jar<br />
*org.eclipse.persistence.core.jar<br />
*org.eclipse.persistence.oracle.jar<br />
*javax.persistence.jar<br />
*org.eclipse.persistence.dbws.jar<br />
<br />
<br> 2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp; <br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.comhttps://wiki.eclipse.org/index.php?title=EclipseLink/Examples/JPARS/Simple&diff=333091EclipseLink/Examples/JPARS/Simple2013-04-08T13:46:57Z<p>Gul.onural.oracle.com: </p>
<hr />
<div>== Simple Example - student ==<br />
<br />
<div style="float:right;width:300px"><div align="center" style="background:#ffffff;width:275px"><br />
__TOC__ <br />
</div> </div><br />
<br />
The "student" example is intended to provide a simple example of using [[EclipseLink/Release/2.4.0/JPA-RS | JPA-RS]] with a single entity persistence unit in a web application.<br />
<br />
=== Environment ===<br />
<br />
The following are the minimal requirements for this example.<br />
<br />
* EclipseLink 2.4.2<br />
* Eclipse Java EE IDE - Juno Release<br />
* Git access to [http://git.eclipse.org/c/eclipselink/examples.git/tree/ eclipselink examples git repository]. The steps to connect to the repo can be found below.<br />
* Glassfish 3.1.2 or later<br />
* REST client ([https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Chrome Postman REST Client] is used in this example, but you can use your favorite REST Client)<br />
<br />
=== Overview ===<br />
<br />
The following steps will be performed in setting up and running this example in your own environment <br />
<br />
#Installation &amp; Configuration <br />
#*Check out student example from GIT <br />
#*Database connectivity <br />
#*GlassFish - Datasource configuration <br />
#*Verify config <br />
#*Deploy web application <br />
#Running the Example<br> <br />
#*View metadata <br />
#*Create entity<br />
#*Update entity <br />
#*Query entity <br />
#*Delete entity<br />
<br />
<span style="display: none;" id="1362671130064S">&nbsp;</span><br />
<br />
== Installation and Configuration ==<br />
<br />
1. If you are using Glassfish installation earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink binaries from http://www.eclipse.org/eclipselink/downloads/. Choose OSGI bundles from the available downloads. Replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above:<br />
<br />
- org.eclipse.persistence.antlr.jar<br />
- org.eclipse.persistence.jpa.jar<br />
- org.eclipse.persistence.asm.jar<br />
- org.eclipse.persistence.jpa.modelgen.jar<br />
- org.eclipse.persistence.core.jar<br />
- org.eclipse.persistence.oracle.jar<br />
- javax.persistence.jar<br />
- org.eclipse.persistence.dbws.jar<br />
<br />
<br />
2. Clone "examples" from git. The "student" example is stored under [http://git.eclipse.org/c/eclipselink/examples.git/tree/student student]&nbsp;folder. <br />
<br />
git clone git://git.eclipse.org/gitroot/eclipselink/examples.git<br />
<br />
3. Configure datasource. Create an XA Datasource connection pool called "'''JPARSStudentDS'''" and define a new&nbsp;JDBC Resource using this connection pool. You can use any of the databases supported by the eclipselink. <br> <br> [[Image:2013-03-07 12 31 16-.png|Configuring JDBC Connection Pool]] <br> <br> [[Image:JDBC Resource.png|JDBC Resource]] <br> <br />
<br />
<br> <br />
<br />
4. Lauch eclipse. Select File-&gt;Import-&gt;Maven-&gt;Existing Maven Projects, hit next and point Root Directory to student folder. Hit finish. <br />
<br />
<br> <br />
<br />
[[Image:2013-03-07 12 57 52-Java EE - Eclipse Platform.png]] <br />
<br />
<br> <br />
<br />
5. Build the student project. <br />
<br />
6.Configure a server. Click "new server wizard" link on the Servers tab. <br />
<br />
<br> <br />
<br />
[[Image:Server.png]] <br />
<br />
<br> <br />
<br />
7. Select GlassFish 3.1.2 <br />
<br />
<br> <br />
<br />
[[Image:Gf.png]] <br />
<br />
<br> <br />
<br />
8. Enter domain directory, admin name and password based on your installation and hit Finish. <br />
<br />
<br> <br />
<br />
[[Image:Example domain.png]] <br />
<br />
<br> <br />
<br />
9. Deploy student.web. Right click on the Glassfish (on Servers tab), select "student.web" in available resources list. Hit Add and Finish. <br />
<br />
<br> <br />
<br />
[[Image:St deploy.png]] <br />
<br />
<br> <br />
<br />
Now, you are ready to run the student example.&nbsp;<br />
<br />
== Running the Example ==<br />
<br />
*Launch Chrome and Postman <br />
*Get metadata: GET http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/metadata<br />
<br />
[[Image:Metadata 2.png]]<br> <br />
<br />
<br> <br />
<br />
*Create a student with a course: POST http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/ &nbsp;(with the following body as an example):<br />
<br />
&nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "id": 65,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "name": "Jane Smith",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "courses": [<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"id":101,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"name": "math"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; } <br />
<br />
<br> <br />
<br />
[[Image:Post.png]] <br />
<br />
<br> <br />
<br />
*Execute a named query: GET&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/query/Student.findAll to execute named query findAll query as defined in the eclipselink.example.jpars.student.model.Student entity.<br />
<br />
[[Image:Query.png]] <br />
<br />
<br> <br />
<br />
*Delete student: DELETE&nbsp;http://localhost:8080/student.web/persistence/v1.0/jpars_example_student/entity/Student/65<br />
<br />
[[Image:Delete.png]]</div>Gul.onural.oracle.com