Showing posts with label JPA. Show all posts
Showing posts with label JPA. Show all posts

Saturday, July 26, 2014

JSF 1.2: Project Woodstock Application using JPA

Woodstock Dataprovider Entity Example
Here is another example of using Project Woodstock along with JPA in an Enterprise Application. The project requires the sample database included in NetBeans.

The project was updated using NetBeans 6.5.1.


The code for the project can be found on Bitbucket here: WoodstockJPAApplication

Monday, July 02, 2012

Typed Query RESTful Service Example

This example demonstrates how to use a TypedQuery<T> in a JAX-RS (Jersey) application. The service implementation utilizes a @Stateless session bean to handle the transactions, and scale the application. The application was developed using NetBeans, and GlassFish 3.1.2.

The primary reason for using a TypedQuery<T> is to maintain type safety, and give the compiler a chance to determine if there are any problems with the code. This combined with a CriteriaQuery<T> provide additional safety and functionality that was not available in Java EE5 and JPA 1.0.

There is additional functionality in the application. There is an index page which leads to the examples.

The project can be downloaded here: TypedQueryExample.zip

Interesting Bits...


Tuesday, August 23, 2011

@PostConstruct Example Using Stateless Session Beans and CDI

There was a question posed about using @PostConstruct to initialize JSF fields from a database on the NetBeans Java EE Forum. I thought I would write a quick example of how to use @PostConstruct to initialize a list of customers, and select one to display.

This example also includes using a stateless session bean directly with the @Named annotation from Context and Dependency Injection (CDI).

All of this was accomplished using NetBeans 7.0.1.

Index.java



A copy of the project can be downloaded here: postconstruct.zip

Friday, July 01, 2011

Java EE 6: Using an External JPA Library in an EJB

I was looking at the NetBeans Forums for Java Enterprise Edition (EE) Development. I saw a couple of folks who were asking how I did a couple of different projects where I sent them the final result, but not an explanation of how I did it.

I decided to do a YouTube video instead of writing out how I did it. I thought the best way to demonstrate it was in a video. "A picture tells a thousand words."

Thursday, June 23, 2011

NetBeans 7.0 Tip: Generating SerialVersionUID for Serializable Objects

If you are doing any work on a class which implements Serializable, you should take the time to generate a unique serialVersionUID for the class. By default, the IDE will add a serialVersionUID which is defined as 1L.This is a rather poor substitute for doing it correctly. The serialVersionUID is extremely important in Web Development (Session scoped beans must be Serializable), and in Java Persistence API (JPA) which needs to be able to serialize entities.

I have covered this plugin in a previous blog post, but there is an updated NetBeans plugin to help you with serialization. The Kenai project is located here: serialVersionUID generator for Netbeans. The actual downloadable nbm for NetBeans 7.0 is located here: eu-easyedu-netbeans-svuid.nbm. It was the first plugin I looked for when I installed NetBeans 7.0.
Enhanced by Zemanta

Friday, August 20, 2010

SerialVersionUID Generator for NetBeans

Are creating serialVersionUID values getting you down?

I have been using 's SerialVersionUID Generator For NetBeans tool for a couple of years now. It used to be available for download from the NetBeans update site, but version 1.9.6 for NetBeans 6.9 has not been available. The current version for use with NetBeans 6.9 can be downloaded from here: eu-easyedu-netbeans-svuid-1.9.6.nbm

This fantastic plug-in is great for generating the serialVersionUID values as part of the Serializable interface contract. If you are doing work with Java Persistence API (JPA) you will definitely want this little plug-in to make your life easier.

  1. You will get a hint on the class about the missing serialVersionUID if you implement Serializable.
  2. Right-click on the class and pick from two options:


    • Add default serialVersionUID
    • Add generated serialVersionUID
Enhanced by Zemanta

Popular Posts