Package nom

Examples of nom.Obiect


      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


  }

  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");
    for (Catalog cInd : c) {
View Full Code Here

  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")
          .setParameter("v1", c.getIdObiect());
      o = (Obiect) query.getSingleResult();
      if (!o.equals(null)) {
        listaObiecte.add(o.getNume());
      }

    }

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

    em.close();
    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(
View Full Code Here

  @SuppressWarnings("unchecked")
  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();

    }

   
    int i = 0;
View Full Code Here

      List<CatalogBean> modificari, String obiect) {
    List<CatalogBean> catalog = new ArrayList<CatalogBean>();
    List<Catalog> c = new ArrayList<Catalog>();
    List<Catalog> cModificari = new ArrayList<Catalog>();
   
    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();
   

    }
    for(CatalogBean ind:modificari){
      cModificari.add(ind.getC());
    }
    System.out.println(c.size());
    for(Catalog ind:cModificari){
      c.remove(ind);
      System.out.println(action+"   "+c.contains(ind)+"  "+obiect);
    }
     
     
       
        int i = 0;
        for (Catalog cInd : c) {

          CatalogBean v = new CatalogBean();
          v.setId(String.valueOf(i++));
          v.setC(cInd);
          v.setSelected(false);
          catalog.add(v);

        }
     
     
   
    ol.setCatalog(c);
    em.merge(ol);
    em.getTransaction().commit();
    em.close();

    return catalog;
View Full Code Here

  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();
    Query query;
    EntityManagerFactory emf = Persistence
        .createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
View Full Code Here

  }

  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

  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();
    Query query;
    EntityManagerFactory emf = Persistence
        .createEntityManagerFactory("modul3L2");
    em = emf.createEntityManager();
    em.getTransaction().begin();
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.