Package nom

Examples of nom.Student


    g.setNumeGrupa(numeGrupaTest);
    em.persist(g);
    int idGr = g.getIdGrupa();
    final int n = 10;
    for (int i = 0; i < n; i++) {
      Student s = new Student();
      s.setIdGrupa(idGr);
      s.setAnStudiu(anStudiuTest);
      s.setEmail(emailTest);
      s.setNrMatricol(String.valueOf(i));
      s.setNume(numeTest + String.valueOf(i));
      s.setPrenume(prenumeTest + String.valueOf(i));
      Catalog c = new Catalog();
      c.setIdStudent(s.getIdStudent());
      c.setDataNotei(new Date());
      c.setIdObiect(idObiectTest + i);
      c.setNota(notaTest);
      c.setNrPrezente(nrPrezenteTest);
      s.getCatalog().add(c);
      Orar o = new Orar();
      o.setData(new Date());
      o.setIdObiect(idObiectTest + i);
      o.setIntervalOrar(intervalOrarTest);
      o.setSalaCurs(salaCursTest);
View Full Code Here


    if (st.size()==1) {

      return "student existent";
    }else{
      Student s=new Student();
      s.setAnStudiu(Integer.valueOf(studentForm.getAn()).intValue());
      s.setNrMatricol(studentForm.getNrMatricol());
      s.setNume(studentForm.getNume());
      s.setPrenume(studentForm.getPrenume());
      s.setEmail(studentForm.getEmail());
      List<Grupa> g=new ArrayList<Grupa>();
      em.getTransaction().begin();
      Query query = em
          .createQuery(
              "SELECT g FROM Grupa g WHERE g.numeGrupa=:v1")
          .setParameter("v1", studentForm.getGrupa());
      g=query.getResultList();
      Grupa gr= new Grupa();
      if (g.size()==1){
       
        gr=g.get(0);
        s.setIdGrupa(gr.getIdGrupa());
        gr.getStudenti().add(s);
        em.merge(gr);
       
      }else{
        gr.setNumeGrupa(studentForm.getGrupa());
        s.setIdGrupa(0);
        gr.getStudenti().add(s);
        em.persist(gr);
      }
     
     
View Full Code Here

      return 0;
    }
  };
  @PostConstruct
  private void init(){
    student = new Student();
    listaStudenti = new ArrayList<Student>();
  }
View Full Code Here

  private void init(){
    student = new Student();
    listaStudenti = new ArrayList<Student>();
  }
  public Student findStudent(int row){
    Student studentGasit = new Student();
    studentGasit =listaStudenti.get(row);
    return studentGasit;
  }
View Full Code Here

    g.setNumeGrupa(numeGrupaTest);
    em.persist(g);
    int idGr = g.getIdGrupa();
    final int n = 10;
    for (int i = 0; i < n; i++) {
      Student s = new Student();
      s.setIdGrupa(idGr);
      s.setAnStudiu(anStudiuTest);
      s.setEmail(emailTest);
      s.setNrMatricol(String.valueOf(i));
      s.setNume(numeTest + String.valueOf(i));
      s.setPrenume(prenumeTest + String.valueOf(i));
      Catalog c = new Catalog();
      c.setIdStudent(s.getIdStudent());
      c.setDataNotei(new Date());
      c.setIdObiect(idObiectTest + i);
      c.setNota(notaTest);
      c.setNrPrezente(nrPrezenteTest);
      s.getCatalog().add(c);
      Orar o = new Orar();
      o.setData(new Date());
      o.setIdObiect(idObiectTest + i);
      o.setIntervalOrar(intervalOrarTest);
      o.setSalaCurs(salaCursTest);
View Full Code Here

    return obiecte;
  }
  @SuppressWarnings("unchecked")
  public static List<String> generareListaObiecte(String nume, String prenume) {
    List<String> listaObiecte = new ArrayList<String>();
    Student s = new Student();
    Query query;
    EntityManagerFactory emf = Persistence
        .createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
    query = em
        .createQuery(
            "SELECT s FROM Student s WHERE s.nume=:v1 AND s.prenume=:v2")
        .setParameter("v1", nume).setParameter("v2", prenume);
    s = (Student) query.getSingleResult();   
    query=em.createNativeQuery("SELECT obiect.nume FROM Obiect WHERE obiect.id_obiect IN " +
        "(SELECT catalog.catalog_id_obiect FROM Catalog WHERE catalog.catalog_id_student=?1)")
        .setParameter(1, s.getIdStudent());
    listaObiecte=query.getResultList();
    em.getTransaction().commit();
    return listaObiecte;
  }
View Full Code Here

    return catalog;
  }

  public static void aplliedAction(List<CatalogBean> modificari) {
    Obiect ol = new Obiect();
    Student st=new Student();
    int idStudent=-1;
    int idObiect=-1;
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
    idObiect=modificari.get(0).getC().getIdObiect();
    idStudent=modificari.get(0).getC().getIdStudent();
   
    Query query = em
        .createQuery("SELECT o FROM Obiect o WHERE o.idObiect=:v1 ")
        .setParameter("v1", idObiect);

    ol = (Obiect) query.getSingleResult();
    query = em
        .createQuery("SELECT s FROM Student s WHERE s.idStudent=:v1 ")
        .setParameter("v1", idStudent);
    st=(Student)query.getSingleResult();
   
   
    if (!ol.equals(null)) {
     ol.setCatalog(new ArrayList<Catalog>());
    }
    if(!st.equals(null)){
      st.setCatalog(new ArrayList<Catalog>());
    }
    for(CatalogBean cInd:modificari){
      if((cInd.getC().getIdObiect()==0)&&(cInd.getC().getIdStudent()==0)){
        cInd.getC().setIdObiect(idObiect);
        cInd.getC().setIdStudent(idStudent);
      }
      ol.getCatalog().add(cInd.getC());
      st.getCatalog().add(cInd.getC());
    }   
    em.merge(ol);
    em.merge(st);
     em.createNativeQuery(
         "DELETE FROM Catalog WHERE catalog_id_student is null AND catalog_id_obiect is null")
View Full Code Here

    if (q1 || q2) {

      return "student existent";
    } else {
      Student s = new Student();
      s.setAnStudiu(Integer.valueOf(studentForm.getAn()).intValue());
      s.setNrMatricol(studentForm.getNrMatricol());
      s.setNume(studentForm.getNume());
      s.setPrenume(studentForm.getPrenume());
      s.setEmail(studentForm.getEmail());
      List<Grupa> g = new ArrayList<Grupa>();
      EntityManagerFactory emf = Persistence
          .createEntityManagerFactory("modul3L2");
      em = emf.createEntityManager();
      em.getTransaction().begin();
      query = em.createQuery(
          "SELECT g FROM Grupa g WHERE g.numeGrupa=:v1")
          .setParameter("v1", studentForm.getGrupa());
      g = query.getResultList();
      Grupa gr = new Grupa();
      if (g.size() == 1) {

        gr = g.get(0);
        s.setIdGrupa(gr.getIdGrupa());
        gr.getStudenti().add(s);
        em.merge(gr);

      } else {
        gr.setNumeGrupa(studentForm.getGrupa());
        s.setIdGrupa(0);
        gr.getStudenti().add(s);
        em.persist(gr);
      }

    }
View Full Code Here

public class UserService {
  private static EntityManager em;

  public static List<String> generareListaObiecte(String nume, String prenume) {
    List<String> listaObiecte = new ArrayList<String>();
    Student s = new Student();
    Obiect o = new Obiect();
    List<Catalog> catalogStudent = new ArrayList<Catalog>();
    Query query;
    EntityManagerFactory emf = Persistence
        .createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
    query = em
        .createQuery(
            "SELECT s FROM Student s WHERE s.nume=:v1 AND s.prenume=:v2")
        .setParameter("v1", nume).setParameter("v2", prenume);
    s = (Student) query.getSingleResult();
    if (!s.equals(null)) {
      catalogStudent = s.getCatalog();
    }

    for (Catalog c : catalogStudent) {
      query = em.createQuery(
          "SELECT o FROM Obiect o WHERE o.idObiect=:v1")
View Full Code Here

    if (q1 || q2) {

      return "student existent";
    } else {
      Student s = new Student();
      s.setAnStudiu(Integer.valueOf(studentForm.getAn()).intValue());
      s.setNrMatricol(studentForm.getNrMatricol());
      s.setNume(studentForm.getNume());
      s.setPrenume(studentForm.getPrenume());
      s.setEmail(studentForm.getEmail());
      List<Grupa> g = new ArrayList<Grupa>();
      EntityManagerFactory emf = Persistence
          .createEntityManagerFactory("modul3L2");
      em = emf.createEntityManager();
      em.getTransaction().begin();
      query = em.createQuery(
          "SELECT g FROM Grupa g WHERE g.numeGrupa=:v1")
          .setParameter("v1", studentForm.getGrupa());
      g = query.getResultList();
      Grupa gr = new Grupa();
      if (g.size() == 1) {

        gr = g.get(0);
        s.setIdGrupa(gr.getIdGrupa());
        gr.getStudenti().add(s);
        em.merge(gr);

      } else {
        gr.setNumeGrupa(studentForm.getGrupa());
        s.setIdGrupa(0);
        gr.getStudenti().add(s);
        em.persist(gr);
      }

    }
View Full Code Here

TOP

Related Classes of nom.Student

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.