public DBElection(Election el) {
    this.choice = new Vector<DBChoice>();
    this.setId(el.getId());
    this.setPrivateKey(el.getPrivateKey());
    this.setPublicKey(el.getPublicKey());
    this.setQuestion(el.getQuestion());
    this.setTitle(el.getTitle());
    this.setUrl(el.getUrl());
    this.setValidFrom(
        new java.sql.Date(el.getValidFrom().toGregorianCalendar().getTime().getTime()));
    this.setValidTo(new java.sql.Date(el.getValidTo().toGregorianCalendar().getTime().getTime()));

    for (int i = 0; i < el.getChoice().size(); i++) {
      this.choice.add(new DBChoice(el.getChoice().get(i)));
    }
  }
  // added:
  public Election convert() throws DatatypeConfigurationException {
    Election el = new Election();
    el.setId(this.getId().toString());
    el.setPrivateKey(this.getPrivateKey());
    el.setPublicKey(this.getPublicKey());
    el.setTitle(this.getTitle());
    el.setQuestion(this.getQuestion());
    el.setUrl(this.getUrl());

    GregorianCalendar c = new GregorianCalendar();
    c.setTime(this.getValidFrom());
    el.setValidFrom(DatatypeFactory.newInstance().newXMLGregorianCalendar(c));
    c.setTime(this.getValidTo());
    el.setValidTo(DatatypeFactory.newInstance().newXMLGregorianCalendar(c));

    for (int i = 0; i < this.choice.size(); i++) {
      el.getChoice().add(choice.get(i).convert());
    }
    return el;
  }