Package data

Examples of data.Person


        try {
            Connection connection = DataBaseManager.getConnection(JDBC_DRIVER, DB_URL, USER, PASS);
            DBOperations.createDBSchema(connection, "ssnewschema");
            service.DBOperations.createTableInSchema(connection, "ssnewschema", "table2");

            DBOperations.insertData(new Person("Malchvich", "Jonh", "Kreshatik 14", "TOKIO"), connection, "ssnewschema", "table1");

            System.out.println("HAPPY END");
            connection.close();
        } catch (SQLException e) {
            System.out.println("SQL EXCEPTION");
View Full Code Here


   * @param id Die ID der Person
   * @return Person mit der ID oder null
   */
  public Person getPersonById(int id) {
   
    Person person = (Person) session.get(Person.class, id);
    return person;
   
  }
View Full Code Here

    m.setLogin("max");
    m.setPasswort("max");
   
    this.addMakler(m);
   
    Person p1 = new Person();
    p1.setAdresse("Informatikum");
    p1.setNachname("Mustermann");
    p1.setVorname("Erika");
   
   
    Person p2 = new Person();
    p2.setAdresse("Reeperbahn 9");
    p2.setNachname("Albers");
    p2.setVorname("Hans");
   
    this.addPerson(p1);
    this.addPerson(p2);
   
    Haus h = new Haus();
View Full Code Here

  /**
   * Legt eine neue Person an, nachdem der Benutzer
   * die entprechenden Daten eingegeben hat.
   */
  public void newPerson() {
    Person p = new Person();
   
    p.setVorname(FormUtil.readString("Vorname"));
    p.setNachname(FormUtil.readString("Nachname"));
    p.setAdresse(FormUtil.readString("Adresse"));
    service.addPerson(p);
   
    System.out.println("Person mit der ID "+p.getId()+" wurde erzeugt.");
  }
View Full Code Here

    int id = personSelectionMenu.show();
   
    //Person barbeiten?
    if(id != PersonSelectionMenu.BACK) {
      //Person laden
      Person p = service.getPersonById(id);
      System.out.println("Person "+p.getVorname()+" "+p.getNachname()+" wird bearbeitet. Leere Felder bleiben unverändert.");
     
      //Neue Daten einlesen
      String newVorname = FormUtil.readString("Vorname ("+p.getVorname()+")");
      String newNachname = FormUtil.readString("Nachname ("+p.getNachname()+")");
      String newAddress = FormUtil.readString("Adresse ("+p.getAdresse()+")");
     
      //Neue Daten setzen
      if(!newVorname.equals(""))
        p.setVorname(newVorname);
      if(!newNachname.equals(""))
        p.setNachname(newNachname);
      if(!newAddress.equals(""))
        p.setAdresse(newAddress);
     
      service.editPerson(p);
    }
  }
View Full Code Here

    Menu personSelectionMenu = new PersonSelectionMenu("Person bearbeiten", service.getAllPersons());
    int id = personSelectionMenu.show();
   
    //Löschen, falls nicht "zurück" gewählt wurde
    if(id != PersonSelectionMenu.BACK) {
      Person p = service.getPersonById(id);
      service.deletePerson(p);
    }
  }
View Full Code Here

  public PersonSelectionMenu(String title, Set<Person> personen) {
    super(title);
   
    Iterator<Person> it = personen.iterator();
    while(it.hasNext()) {
      Person p = it.next();
      addEntry(p.getVorname()+" "+p.getNachname(), p.getId());
    }
    addEntry("Zur√ºck", BACK);
  }
View Full Code Here

   
    return null;*/
   
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = (Person) session.get(Person.class, id);
    session.getTransaction().commit();
   
    if (person == null) {
      return null;
    }
View Full Code Here

   */
  public void addPerson(Person p) {
    /*person.add(p);*/
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = new Person();
    person = p;
    session.save(person);
    session.getTransaction().commit();
  }
View Full Code Here

   */
  public void deletePerson(Person p) {
    //personen.remove(p);
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();
    Person person = new Person();
    person = p;
    session.delete(person);
    session.getTransaction().commit();
  }
View Full Code Here

TOP

Related Classes of data.Person

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.