Object Database Programming with JPA and NetBeans
I have been developing Java applications for a long time and the major difficulty was the coding part related to database manipulations. Recently I shifted to use Object-Relational Mapping through JPA. I have used TopLink, EclipseLink, and Hibernate. I could achieve the functionally I want with ease without worrying on the database development. I have also used some Object databases like neoDatis directly which need no object relational mapping. Finally I found the ObjectDB, an Object database for Java which supports JPA.
This article demonstrates how to create a simple JAVA Standard application in NetBeans using ObjectDB and JPA. The demonstrated application uses JPA to store and retrieve objects of two entity classes from an Embedded ObjectDB. It will demonstrate the capabilities of ObjectDB and JPA, which include persisting objects, removing saved objects and retrieving persisted objects. For this tutorial, besides the Java JDK and the NetBeans IDE, you only need to download and extract the ObjectDB distribution zip file. The distribution zip contains everything necessary without any external dependency.
This tutorial consists of the following steps:
- Step 1: Create an ObjectDB Enabled Java SE Project
- Step 2: Define a JPA Entity Classes
- Step 3: Add a Main Class
- Step 4: Design a Graphical User Interface
- Step 5: Code user-defined Methods
- Step 6: Code Events of Controls
- Step 7: Run the program
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)