Skip to content

eleves-ig2i/ig2i-le4-poo-2018-tp2

Repository files navigation

Session 2 Build Status

Description

This TP was realized with JPA inheritance and especially with the so-called "join" strategy. It's the continuation of the previous TP and allows to illustrate the following notions :

  • mapping of inheritance relationships
  • inserted classes
  • JPA query language (JPQL)

Table of contents

Installation

Prerequisites

You need to :

  • Java
  • NetBeans

Java

Ressources
Install
sudo aptitude update
sudo aptitude install openjdk-8-jdk
#Probably useless stuff
#sudo apt-get purge openjdk
#sudo apt-get purge oracle-java8-installer
#sudo apt-get purge oracle-java9-installer
#sudo aptitude install libderby-java libderbyclient-java
#sudo apt-get install python-software-properties software-properties-common
#sudo add-apt-repository ppa:webupd8team/java
#sudo apt-get install oracle-java8-installer
#sudo apt-get install oracle-java8-set-default

NetBeans

Ressources
Install
cd ~
mv Downloads/netbeans-8.2-javaee-linux.sh ./
chmod +x ./netbeans-8.2-javaee-linux.sh
# Select Glassfish AND Tomcat
# For JDK installation path, select /usr/lib/jvm/java-8-openjdk-amd64
./netbeans-8.2-javaee-linux.sht

Installing

Create the project

  • Clone the repository in your local machine
  • Open NetBeans
  • File > Open Project > ${repo name}
  • [Open Project]

Setup Database

  • Open Netbeans
  • Services > Databases > Java DB > Start Server
  • Services > Databases > Java DB > Create Database
    • Database Name : database
    • User Name : username
    • Password : password
    • Password : password
  • [OK]
  • Services > Databases > jdbc:derby... > connect

Setup Project

  • Open Netbeans
  • File > Project Properties ${project name} > Build > Compilation
    • [Check] Compile on Save
    • [Check] Enable Annotation Processing
  • [OK]

Setup JDBC

  • Open Netbeans
  • Projects > ${project name} > Librairies > Add Librairies
    • [Import] > Java DB Driver
    • [Add Library]

Setup Persistance

  • Open Netbeans
  • Projects > ${project name} > Librairies > Add Librairies
    • [Import] > EclipseLink (JPA X.X)
    • [Add Library]

Setup Persistance Unit

  • Open Netbeans
  • [Open] META-INF > persistence.xml
    • PU name : ${persistance name}
    • Database Connection : jdbc:derby...
    • Table Generation Strategy : Drop and create
    • [Add] Properties > eclipselink.logging.level : INFO
    • [Add] Properties > eclipselink.ddl-generation.ouput-mode : both
    • [Add] Properties > eclipselink.ddl-generation : drop-and-create-tables

Authors

License

This TP is licensed under the MIT License - see the LICENSE file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published