resulution bug
This commit is contained in:
32
src/main/java/com/test/bdd/SalarieJpa.java
Normal file
32
src/main/java/com/test/bdd/SalarieJpa.java
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.test.bdd;
|
||||
|
||||
import com.test.beans.Salarie;
|
||||
import jakarta.ejb.Stateless;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emile.malcuit
|
||||
*/
|
||||
@Stateless
|
||||
public class SalarieJpa {
|
||||
@PersistenceContext(unitName = "bdclientPU") //en lien avec le fichier persistence.xml : <persistence-unit name="bdclientPU" transaction-type="JTA">
|
||||
private EntityManager em;
|
||||
|
||||
// Lecture de tous les clients
|
||||
public List<Salarie> readAll() {
|
||||
List<Salarie> lesSalaries = em.createQuery("SELECT c FROM Salarie c", Salarie.class).getResultList();
|
||||
return lesSalaries;
|
||||
}
|
||||
|
||||
public Salarie find(Salarie unSalarie){
|
||||
return em.find(Salarie.class, unSalarie);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user