On the next window, select update snapshots (to ensure you have the latest libraries) and click 'OK'

+

On the next window, select the 'Update Snapshots' checkbox (to ensure you have the latest libraries) and click 'Run'

[[Image:buildp2.jpg]]

[[Image:buildp2.jpg]]

+

+

Once the build has completed you should see the following 'SUCCESS' in the console window. Scrolling the console window you'll see test results of building, populating the database and some coded tests of the models. In your directory structure, the necessary jar and war files are created and ready to be deployed to your container.

+

+

[[Image:build-success.jpg]]

=== Setup your Container ===

=== Setup your Container ===

* Requires a data source named 'java:global/employeeDS' which the user is required to set up.

* Requires a data source named 'java:global/employeeDS' which the user is required to set up.

+

* It must be setup to use JTA transactions.

=== Deploy and Try ===

=== Deploy and Try ===

−

Once the application is successfully deployed you can navigate to the homepage in your browser (http://localhost:7001/employee.web/):

+

Within Eclipse, to deploy your application you may use the context menu to select 'Run On Server'.

+

+

[[Image:deploy.jpg]]

Note: When deploying your app from Eclipse, ensure under Server Properties that you set the Publishing Mode to '''"Publish as an exploded archive"'''.

Note: When deploying your app from Eclipse, ensure under Server Properties that you set the Publishing Mode to '''"Publish as an exploded archive"'''.

+

+

Once the application is successfully deployed you can use the example within Eclipse.

+

+

[[Image:deployed.jpg]]

+

+

Alternatively you may also navigate to the homepage in your browser of choice (http://localhost:7001/employee.web/):

Check out the code

Build and Test

The model project comes with test cases that validate the JPA model and its services function correctly. It is configured to run on embedded derby by default so generally running 'mvn test' in the model project will run the examples and test cases and let you know that everything is working correctly.

If using the model within Eclipse you can build using the right click context menu on the employee project.

On the prompt window, click 'OK'

On the next window, select the 'Update Snapshots' checkbox (to ensure you have the latest libraries) and click 'Run'

Once the build has completed you should see the following 'SUCCESS' in the console window. Scrolling the console window you'll see test results of building, populating the database and some coded tests of the models. In your directory structure, the necessary jar and war files are created and ready to be deployed to your container.

Setup your Container

Requires a data source named 'java:global/employeeDS' which the user is required to set up.

It must be setup to use JTA transactions.

Deploy and Try

Within Eclipse, to deploy your application you may use the context menu to select 'Run On Server'.

Note: When deploying your app from Eclipse, ensure under Server Properties that you set the Publishing Mode to "Publish as an exploded archive".

Once the application is successfully deployed you can use the example within Eclipse.

The first thing you'll want to do at this point is set up your database tables from the Admin page. You can also populate some test data from there as well:

Now, you're ready to query (search) the database, add new employees and delete some as well.

Try this, from the home page where you can do a basic search, use the defaulted wildcard values to search for all the employees.

This should bring you the search results page.

From here you can edit or delete employees as needed. By clicking the Edit button this will present you a page where a number of changes can be made for a specific employee. Maybe someone needs a pay increase?! Once all necessary changes are made, click Save to update this employee on the database.

From the edit page you may also Delete employees, give it a shot!

Lastly, why not create some new employees, the current group of minions aren't getting any younger ;-)

So there you have it in a nutshell. Play around with the app some more, try advance searching where you can use EclipseLink's pagination options etc.

Understanding the Example

Employee Model

The employee model has existed in TopLink and EclipseLink since the mid 90's. The model has evolved a little over the years based on enhancements made available in the mappings. The following class diagram details the Employee model used in this example.

Feedback

If you encounter any issues with the example, please let us know either through: