Package nom

Examples of nom.Obiect


  }

  public static List<CatalogBean> listareCatalog(String obiect) {
    List<Catalog> c = new ArrayList<Catalog>();
    List<CatalogBean> catalog = new ArrayList<CatalogBean>();
    Obiect ol = new Obiect();

    EntityManagerFactory emf = Persistence
        .createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
    Query query = em
        .createQuery("SELECT o FROM Obiect o WHERE o.nume=:v1 ")
        .setParameter("v1", obiect);

    ol = (Obiect) query.getSingleResult();

    if (!ol.equals(null)) {
      c = ol.getCatalog();

    }
    SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/YYYY");
    int i = 0;
    for (Catalog cInd : c) {
View Full Code Here


    em.close();
    return catalog;
  }

  public static void aplliedAction(List<CatalogBean> modificari) {
    Obiect ol = new Obiect();
    Student st=new Student();
    List<Catalog>removals=new ArrayList<Catalog>();
    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(
View Full Code Here

      p.setNume(numeProfesor+i);
      p.setPrenume(prenumeProfesor+i);
      p.setSitePersonal("site");
     
      for(int j=0;j<2;j++){
        Obiect o=new Obiect();
        o.setNume("obiect"+j);
        o.setIdEvaluare(j);
        o.setCredite(j+1);
        p.getObiecte().add(o);
       
      }
     
      em.persist(p);
View Full Code Here

TOP

Related Classes of nom.Obiect

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.