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))); } }