private void readtblfirma() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(ConverterExecutor.class.getResourceAsStream("tblfirma.csv")));
      List<String[]> input = reader.readAll();

      for (String[] values : input) {
        String id = values[0];
        String firma = values[1];
        String brancheId = values[2];
        String size = values[3];

        Company comp = new Company();
        comp.setId(Long.parseLong(id));
        comp.setCompany(firma);
        comp.setSize(size);

        Sector sec = sectorDao.findById(Long.parseLong(brancheId));
        comp.setSector(sec);

        companyDao.persist(comp);

        companyId_company.put(comp.getId(), comp);
      }

      reader.close();
    } catch (RuntimeException e) {

    } catch (IOException ioe) {

    }
  }
  private void readtbladressen() {
    List<Member> membersDb = memberDao.findAll();
    List<Department> departmentsDb = departmentDao.findAll();
    List<ContactData> contactData = new ArrayList<ContactData>();

    Map<Long, Member> cMemberId_member = new HashMap<Long, Member>();
    Map<Long, Department> cDepartmentId_department = new HashMap<Long, Department>();

    for (Member mem : membersDb) {
      cMemberId_member.put(mem.getId(), mem);
    }

    for (Department dep : departmentsDb) {
      cDepartmentId_department.put(dep.getId(), dep);
    }

    try {
      membersDb.clear();
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tbladressen.csv")));
      List<String[]> input = reader.readAll();
      for (String[] values : input) {
        String mitgliedId = values[0];
        String strasse = values[1];
        String hausNr = values[2];
        String zusatz = values[3];
        String plz = values[4];
        String ort = values[5];
        String land = values[6];
        String telefon = values[7];
        String fax = values[8];
        String mobile = values[9];
        String email = values[10];
        String internet = values[11];
        String abteilungsId = values[12];
        String telefonD = values[13];
        String faxD = values[14];
        String mobileD = values[15];
        String emailD = values[16];
        String internetD = values[17];

        ContactData contact = new ContactData();
        contact.setAddon(zusatz);
        contact.setCountry(land);
        try {
          Department dep = cDepartmentId_department.get(Long.parseLong(abteilungsId));
          if (dep != null) {
            System.out.println(
                "Setting Department with ID " + dep.getId() + " into contact data...");
          }
          contact.setDepartment(dep);
        } catch (NumberFormatException nfe) {
          System.out.println("NFE");
        }
        contact.setEmail(email);
        contact.setEmailD(emailD);
        contact.setFax(fax);
        contact.setFaxD(faxD);
        contact.setInternet(internet);
        contact.setInternetD(internetD);
        contact.setMobile(mobile);
        contact.setMobileD(mobileD);
        contact.setPhone(telefon);
        contact.setPhoneD(telefonD);
        contact.setPostCode(plz);
        contact.setStreet(strasse);
        contact.setTown(ort);
        contact.setNumber(hausNr);

        contactDao.persist(contact);

        Member mem = cMemberId_member.get(Long.parseLong(mitgliedId));
        mem.setContactData(contact);
        if (contact.getDepartment() != null) {
          ContactData data = contactDao.findById(contact.getId());
          mem.setDepartment(contact.getDepartment());
          companyDao.findById(contact.getDepartment().getCompany().getId());
          System.out.println("Company " + contact.getDepartment().getCompany().getId());

          mem.setCompany(companyId_company.get(contact.getDepartment().getCompany().getId()));
        }
        contactData.add(contact);
        membersDb.add(mem);

        memberDao.persist(mem);
      }

      reader.close();
      System.out.println("Ready with Adressen");

      // memberDao.persistAll(membersDb);

    } catch (RuntimeException e) {
      e.printStackTrace();
      System.out.println("Error " + e);
    } catch (IOException ioe) {
      // TODO: handle exception
    }
  }
  private void readtblabteilung() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tblabteilung.csv")));
      List<String[]> input = reader.readAll();

      Map<Long, List<Department>> comp_departments = new HashMap<>();

      for (String[] values : input) {
        String id = values[0];
        String abteilung = values[1];
        String companyId = values[2];
        String strasse = values[3];
        String hausnr = values[4];
        String zusatz = values[5];
        String plz = values[6];
        String ort = values[7];
        String land = values[8];
        String internet = values[9];

        Long companyIdLong = Long.parseLong(companyId);
        // Company comp =
        // companyDao.findById(Long.parseLong(companyId));

        Department dep = new Department();
        dep.setId(Long.parseLong(id));
        dep.setDepartment(abteilung);
        dep.setAddon(zusatz);
        dep.setCountry(land);
        dep.setInternet(internet);
        dep.setNumber(hausnr);
        dep.setPostCode(plz);
        dep.setStreet(strasse);
        dep.setTown(ort);

        departmentDao.persist(dep);

        departmentId_department.put(dep.getId(), dep);

        if (comp_departments.get(companyIdLong) == null) {
          ArrayList<Department> departments = new ArrayList<Department>();
          departments.add(dep);
          comp_departments.put(companyIdLong, departments);
        } else {
          comp_departments.get(companyIdLong).add(dep);
        }
      }

      reader.close();

      for (Long compId : comp_departments.keySet()) {
        Company company = companyDao.findById(compId);
        company.setDepartments(comp_departments.get(compId));
        companyDao.persist(company);

        for (Department dep : comp_departments.get(compId)) {
          dep.setCompany(company);
          departmentDao.persist(dep);
        }
      }
    } catch (RuntimeException e) {

    } catch (IOException ioe) {

    }
  }