Commit 4ef90b12 authored by Lefebvre michael's avatar Lefebvre michael

9 mars

parent 13ab4131
......@@ -3,4 +3,4 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
\ No newline at end of file
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="EclipseLink" />
<datasource-mapping>
<factory-entry name="NewPersistenceUnit" value="98109426-b958-4f0d-9107-6fe6948b96e9" />
</datasource-mapping>
<naming-strategy-map />
<deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/src/META-INF/persistence.xml" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="JPA 2.0" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="NewPersistenceUnit">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>modele.ActeurEntity</class>
<class>modele.ClientEntity</class>
<class>modele.EmpruntEntity</class>
<class>modele.FilmEntity</class>
<class>modele.GenreEntity</class>
<class>modele.PaysEntity</class>
<class>modele.InfoFilmEntity</class>
<properties>
<property name="eclipselink.jdbc.url" value="jdbc:mysql://localhost:3306/cinema"/>
<property name="eclipselink.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="eclipselink.jdbc.user" value="michael"/>
<property name="eclipselink.jdbc.password" value="mdppopmichael"/>
</properties>
</persistence-unit>
</persistence>
package modele;
import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;
@Entity
@Table(name = "ACTEUR", schema = "cinema", catalog = "")
public class ActeurEntity {
private int nacteur;
private String nom;
private String prenom;
private Date naissance;
private Integer nbreFilms;
private PaysEntity pays;
private Collection<FilmEntity> films;
@Id
@Column(name = "nacteur")
public int getNacteur() {
return nacteur;
}
public void setNacteur(int nacteur) {
this.nacteur = nacteur;
}
@Basic
@Column(name = "nom")
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
@Basic
@Column(name = "prenom")
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
@Basic
@Column(name = "naissance")
public Date getNaissance() {
return naissance;
}
public void setNaissance(Date naissance) {
this.naissance = naissance;
}
@Basic
@Column(name = "nbreFilms")
public Integer getNbreFilms() {
return nbreFilms;
}
public void setNbreFilms(Integer nbreFilms) {
this.nbreFilms = nbreFilms;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ActeurEntity that = (ActeurEntity) o;
return nacteur == that.nacteur &&
Objects.equals(nom, that.nom) &&
Objects.equals(prenom, that.prenom) &&
Objects.equals(naissance, that.naissance) &&
Objects.equals(nbreFilms, that.nbreFilms);
}
@Override
public int hashCode() {
return Objects.hash(nacteur, nom, prenom, naissance, nbreFilms);
}
@ManyToOne
@JoinColumn(name = "nationalite", referencedColumnName = "npays")
public PaysEntity getPays() {
return pays;
}
public void setPays(PaysEntity pays) {
this.pays = pays;
}
@OneToMany(mappedBy = "acteurPrincipal")
public Collection<FilmEntity> getFilms() {
return films;
}
public void setFilms(Collection<FilmEntity> films) {
this.films = films;
}
}
package modele;
import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;
@Entity
public class ClientEntity {
private int nclient;
private String nom;
private String prenom;
private String adresse;
private int anciennete;
private Collection<EmpruntEntity> empruntsByNclient;
@Id
@Column(name = "nclient")
public int getNclient() {
return nclient;
}
public void setNclient(int nclient) {
this.nclient = nclient;
}
@Basic
@Column(name = "nom")
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
@Basic
@Column(name = "prenom")
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
@Basic
@Column(name = "adresse")
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
@Basic
@Column(name = "anciennete")
public int getAnciennete() {
return anciennete;
}
public void setAnciennete(int anciennete) {
this.anciennete = anciennete;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClientEntity that = (ClientEntity) o;
return nclient == that.nclient &&
anciennete == that.anciennete &&
Objects.equals(nom, that.nom) &&
Objects.equals(prenom, that.prenom) &&
Objects.equals(adresse, that.adresse);
}
@Override
public int hashCode() {
return Objects.hash(nclient, nom, prenom, adresse, anciennete);
}
@OneToMany(mappedBy = "clientByNclient")
public Collection<EmpruntEntity> getEmpruntsByNclient() {
return empruntsByNclient;
}
public void setEmpruntsByNclient(Collection<EmpruntEntity> empruntsByNclient) {
this.empruntsByNclient = empruntsByNclient;
}
}
package modele;
import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;
@Entity
@Table(name = "EMPRUNT", schema = "cinema", catalog = "")
public class EmpruntEntity {
private int nemprunt;
private String retour;
private Date dateEmprunt;
private ClientEntity clientByNclient;
private FilmEntity filmByNfilm;
@Id
@Column(name = "nemprunt")
public int getNemprunt() {
return nemprunt;
}
public void setNemprunt(int nemprunt) {
this.nemprunt = nemprunt;
}
@Basic
@Column(name = "retour")
public String getRetour() {
return retour;
}
public void setRetour(String retour) {
this.retour = retour;
}
@Basic
@Column(name = "dateEmprunt")
public Date getDateEmprunt() {
return dateEmprunt;
}
public void setDateEmprunt(Date dateEmprunt) {
this.dateEmprunt = dateEmprunt;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmpruntEntity that = (EmpruntEntity) o;
return nemprunt == that.nemprunt &&
Objects.equals(retour, that.retour) &&
Objects.equals(dateEmprunt, that.dateEmprunt);
}
@Override
public int hashCode() {
return Objects.hash(nemprunt, retour, dateEmprunt);
}
@ManyToOne
@JoinColumn(name = "nclient", referencedColumnName = "nclient", nullable = false)
public ClientEntity getClientByNclient() {
return clientByNclient;
}
public void setClientByNclient(ClientEntity clientByNclient) {
this.clientByNclient = clientByNclient;
}
@ManyToOne
@JoinColumn(name = "nfilm", referencedColumnName = "nfilm", nullable = false)
public FilmEntity getFilmByNfilm() {
return filmByNfilm;
}
public void setFilmByNfilm(FilmEntity filmByNfilm) {
this.filmByNfilm = filmByNfilm;
}
}
package modele;
import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;
@Entity
@Table(name = "FILM", schema = "cinema", catalog = "")
public class FilmEntity {
private int nfilm;
private String titre;
private Date sortie;
private String realisateur;
private BigDecimal entrees;
private String oscar;
private Collection<EmpruntEntity> empruntsByNfilm;
private GenreEntity genre;
private PaysEntity pays;
private ActeurEntity acteurPrincipal;
@Id
@Column(name = "nfilm")
public int getNfilm() {
return nfilm;
}
public void setNfilm(int nfilm) {
this.nfilm = nfilm;
}
@Basic
@Column(name = "titre")
public String getTitre() {
return titre;
}
public void setTitre(String titre) {
this.titre = titre;
}
@Basic
@Column(name = "sortie")
public Date getSortie() {
return sortie;
}
public void setSortie(Date sortie) {
this.sortie = sortie;
}
@Basic
@Column(name = "realisateur")
public String getRealisateur() {
return realisateur;
}
public void setRealisateur(String realisateur) {
this.realisateur = realisateur;
}
@Basic
@Column(name = "entrees")
public BigDecimal getEntrees() {
return entrees;
}
public void setEntrees(BigDecimal entrees) {
this.entrees = entrees;
}
@Basic
@Column(name = "oscar")
public String getOscar() {
return oscar;
}
public void setOscar(String oscar) {
this.oscar = oscar;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FilmEntity that = (FilmEntity) o;
return nfilm == that.nfilm &&
Objects.equals(titre, that.titre) &&
Objects.equals(sortie, that.sortie) &&
Objects.equals(realisateur, that.realisateur) &&
Objects.equals(entrees, that.entrees) &&
Objects.equals(oscar, that.oscar);
}
@Override
public int hashCode() {
return Objects.hash(nfilm, titre, sortie, realisateur, entrees, oscar);
}
@OneToMany(mappedBy = "filmByNfilm")
public Collection<EmpruntEntity> getEmpruntsByNfilm() {
return empruntsByNfilm;
}
public void setEmpruntsByNfilm(Collection<EmpruntEntity> empruntsByNfilm) {
this.empruntsByNfilm = empruntsByNfilm;
}
@ManyToOne
@JoinColumn(name = "ngenre", referencedColumnName = "ngenre", nullable = false)
public GenreEntity getGenre() {
return genre;
}
public void setGenre(GenreEntity genre) {
this.genre = genre;
}
@ManyToOne
@JoinColumn(name = "npays", referencedColumnName = "npays", nullable = false)
public PaysEntity getPays() {
return pays;
}
public void setPays(PaysEntity pays) {
this.pays = pays;
}
@ManyToOne
@JoinColumn(name = "nacteurPrincipal", referencedColumnName = "nacteur", nullable = false)
public ActeurEntity getActeurPrincipal() {
return acteurPrincipal;
}
public void setActeurPrincipal(ActeurEntity acteurPrincipal) {
this.acteurPrincipal = acteurPrincipal;
}
}
package modele;
import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;
@Entity
@Table(name = "GENRE", schema = "cinema", catalog = "")
public class GenreEntity {
private int ngenre;
private String nature;
private Collection<FilmEntity> films;
@Id
@Column(name = "ngenre")
public int getNgenre() {
return ngenre;
}
public void setNgenre(int ngenre) {
this.ngenre = ngenre;
}
@Basic
@Column(name = "nature")
public String getNature() {
return nature;
}
public void setNature(String nature) {
this.nature = nature;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GenreEntity that = (GenreEntity) o;
return ngenre == that.ngenre &&
Objects.equals(nature, that.nature);
}
@Override
public int hashCode() {
return Objects.hash(ngenre, nature);
}
@OneToMany(mappedBy = "genre")
public Collection<FilmEntity> getFilms() {
return films;
}
public void setFilms(Collection<FilmEntity> films) {
this.films = films;
}
}
package modele;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;
@Entity
@Table(name = "Info_film", schema = "cinema", catalog = "")
public class InfoFilmEntity {
private int nfilm;
private String titre;
private String nomRealisateur;
private String nomActeur;
@Basic
@Column(name = "NFILM")
public int getNfilm() {
return nfilm;
}
public void setNfilm(int nfilm) {
this.nfilm = nfilm;
}
@Basic
@Column(name = "TITRE")
public String getTitre() {
return titre;
}
public void setTitre(String titre) {
this.titre = titre;
}
@Basic
@Column(name = "NOM_REALISATEUR")
public String getNomRealisateur() {
return nomRealisateur;
}
public void setNomRealisateur(String nomRealisateur) {
this.nomRealisateur = nomRealisateur;
}
@Basic
@Column(name = "NOM_ACTEUR")
public String getNomActeur() {
return nomActeur;
}
public void setNomActeur(String nomActeur) {
this.nomActeur = nomActeur;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InfoFilmEntity that = (InfoFilmEntity) o;
return nfilm == that.nfilm &&
Objects.equals(titre, that.titre) &&
Objects.equals(nomRealisateur, that.nomRealisateur) &&
Objects.equals(nomActeur, that.nomActeur);
}
@Override
public int hashCode() {
return Objects.hash(nfilm, titre, nomRealisateur, nomActeur);
}