Package org.jpa

Examples of org.jpa.Catalog


    studentTest.setNume(numeTest);
    studentTest.setPrenume(prenumeTest);

    em.persist(studentTest);
    for (int i = 0; i < n; i++) {
      Catalog catalogTest = new Catalog();
      catalogTest.setIdStudent(studentTest.getIdStudent());
      catalogTest.setDataNotei(new Date());

      catalogTest.setIdObiect(idObiectTest + i);
      catalogTest.setNota(notaTest);
      catalogTest.setNrPrezente(nrPrezenteTest);
      studentTest.getCatalog().add(catalogTest);
    }

    em.persist(studentTest);
    em.getTransaction().commit();
View Full Code Here


    int idObiectTest=1;
    Date data=new Date();
    int nota=8;
    int nrPrezente=7;
     EntityManager em = emf.createEntityManager();
     Catalog c=new Catalog();
     Catalog cT=new Catalog();
     c.setDataNotei(data);
     c.setIdObiect(idObiectTest);
     c.setIdStudent(idStudentTest);
     c.setNota(nota);
     c.setNrPrezente(nrPrezente);
       em.getTransaction().begin();
       em.persist(c);
         
       em.getTransaction().commit();
       cT=(Catalog) em.createQuery("Select c from Catalog c where c.idStudent=1").getSingleResult();
       assertTrue(cT.getIdStudent()==c.getIdStudent());
       em.getTransaction().begin();
       cT.setNota(7);
       em.getTransaction().commit();
       c=(Catalog) em.createQuery("Select c from Catalog c where c.idStudent=1").getSingleResult();
       assertTrue(c.getNota()==7);
       em.getTransaction().begin();
       int deletedData=em.createQuery("Delete from Catalog c where c.idStudent=1").executeUpdate();
View Full Code Here

    int idObiectTest=1;
    Date data=new Date();
    int nota=8;
    int nrPrezente=7;
     EntityManager em = emf.createEntityManager();
     Catalog c=new Catalog();
   
     Student s=new Student();
    
     c.setDataNotei(data);
     c.setIdObiect(idObiectTest);
     c.setIdStudent(idStudentTest);
     c.setNota(nota);
     c.setNrPrezente(nrPrezente);
     s.getCatalog().add(c);
       em.getTransaction().begin();
       em.persist(s);
      
       em.getTransaction().commit();
View Full Code Here

    int idObiectTest=1;
    Date data=new Date();
    int nota=8;
    int nrPrezente=7;
     EntityManager em = emf.createEntityManager();
     Catalog c=new Catalog();
   
     Obiect o=new Obiect();
    
     c.setDataNotei(data);
     c.setIdObiect(idObiectTest);
     c.setIdStudent(idStudentTest);
     c.setNota(nota);
     c.setNrPrezente(nrPrezente);
     List<Catalog> c_o=new ArrayList<Catalog>();
     c_o.add(c);
     o.setCatalog(c_o);
       em.getTransaction().begin();
       em.persist(o);
View Full Code Here

TOP

Related Classes of org.jpa.Catalog

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.