Tuesday, 2 July 2019

JPA: Setting up the environment


Requirements
a.   Eclipse Link
b.   Apache Derby

What is Eclipse Link?
EclipseLink is a reference implementation for JPA specificaiton.

What is Apache Derby?
Apache Derby is open source RDBMS (Relational database management system) completely written in Java and maintained by Apache.

Follow below steps to setup the environment.

Setting Up Apache Derby
Please go through my below post to setup Apache derby.

Once you setup everything, run below command to start the Derby server.
java -jar derbyrun.jar server start

You can able to see below kind of messages in console.

Sun Jun 24 12:13:37 IST 2018 : Security manager installed using the Basic server security policy.
Sun Jun 24 12:13:37 IST 2018 : Apache Derby Network Server - 10.13.1.1 - (1765088) started and ready to accept connections on port 1527

As you observe above messages, Derby server is running on port 1527.

Setting up Eclipse Link
Create new maven project ‘jpaDemo’ in Eclipse, and add below maven dependency.

                  <!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
                  <dependency>
                           <groupId>org.eclipse.persistence</groupId>
                           <artifactId>eclipselink</artifactId>
                           <version>2.7.2-RC1</version>
                  </dependency>

pom.xml file looks like below.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>jpa_demo</groupId>
 <artifactId>jpa_demo</artifactId>
 <version>1</version>

 <dependencies>
  <!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
  <dependency>
   <groupId>org.eclipse.persistence</groupId>
   <artifactId>eclipselink</artifactId>
   <version>2.7.2-RC1</version>
  </dependency>

 </dependencies>
</project>




Previous                                                    Next                                                    Home

No comments:

Post a Comment