Package org.jpa

Examples of org.jpa.Evaluare


   
    @Test
    public void testPersistUpdateDeleteEvaluare() {
       
        String tipEvaluare="EvaluareTest";
        Evaluare ev=new Evaluare();
        Evaluare evT=new Evaluare();
        Evaluare evT1=new Evaluare();
        ev.setTipEvaluare(tipEvaluare);
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(ev);
        em.getTransaction().commit();
        evT = (Evaluare) em.createQuery("select evT from Evaluare evT where evT.tipEvaluare='EvaluareTest' ").getSingleResult();
        assertTrue("Nu a fost introdusa o inregistrare","EvaluareTest".equals(evT.getTipEvaluare()));
        em.getTransaction().begin();
        evT.setTipEvaluare("EvaluareTest1");
        em.getTransaction().commit();
        evT1=(Evaluare) em.createQuery("select ev from Evaluare ev where ev.tipEvaluare='EvaluareTest1' ").getSingleResult();
        assertTrue("Nu a fost facuta schimbarea ","EvaluareTest1".equals(evT1.getTipEvaluare()));
        em.getTransaction().begin();
        int deletedData = em.createQuery("Delete from Evaluare e").executeUpdate();
        em.getTransaction().commit();
        assertEquals("Tabela avea mai mult de o inregistrare",deletedData, 1);
        em.close();
View Full Code Here


        o1.setPrezenta(prezenta);
        o1.setIdProfesor(idProfesor+1);
        List<Obiect> obev=new ArrayList<Obiect>();
        obev.add(o1);
        obev.add(o);
        Evaluare ev=new Evaluare();
        ev.setTipEvaluare(tipEvaluare);
        ev.setObiect(obev);
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(ev);
        em.getTransaction().commit();  
        List<Obiect> ob=(List<Obiect>)em.createQuery("select o from Obiect o").getResultList();
View Full Code Here

    private Main(){}
    public static void main(String[] args) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("mewp");
        EntityManager em = emf.createEntityManager();

        Evaluare ev = new Evaluare();
        ev.setTipEvaluare("EXAMEN");
      
        em.getTransaction().begin();
        em.persist(ev);
        em.getTransaction().commit();
        em.close();
View Full Code Here

TOP

Related Classes of org.jpa.Evaluare

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.