Hi, I have this classes:
public class Pais implements Serializable {
public void setIdpais(Integer idpais) {
this.idpais = idpais;
}
public Integer getIdpais() {
return idpais;
}
}
public class Usuario implements Serializable {
private Integer idusuario;
private Pais pais;
public Integer getIdusuario() {
return idusuario;
}
public void setIdusuario(Integer idusuario) {
this.idusuario = idusuario;
}
public Pais getPais() {
return pais;
}
public void setPais(Pais pais) {
this.pais = pais;
}
}
running this query:
con.createPreparedQuery(" SELECT * FROM usuario where idusuario = :id")
.addParameter("id", 1)
.addColumnMapping("idpais", "pais.idpais")
.executeAndFetch(Usuario.class);
i get this error:
ERROR [http-nio-8084-exec-223] (HttpSupport.java:69) -
org.sql2o.Sql2oException: Could not map idpais to any property.
at org.sql2o.DefaultResultSetHandlerFactory.newResultSetHandler0(DefaultResultSetHandlerFactory.java:199)
at org.sql2o.DefaultResultSetHandlerFactory.access$200(DefaultResultSetHandlerFactory.java:17)
at org.sql2o.DefaultResultSetHandlerFactory$5.evaluate(DefaultResultSetHandlerFactory.java:160)
at org.sql2o.DefaultResultSetHandlerFactory$5.evaluate(DefaultResultSetHandlerFactory.java:156)
at org.sql2o.tools.AbstractCache.get(AbstractCache.java:49)
at org.sql2o.DefaultResultSetHandlerFactory.newResultSetHandler(DefaultResultSetHandlerFactory.java:173)
at org.sql2o.PojoResultSetIterator.<init>(PojoResultSetIterator.java:20)
at org.sql2o.Query$14.iterator(Query.java:547)
at org.sql2o.Query.executeAndFetch(Query.java:588)
at org.sql2o.Query.executeAndFetch(Query.java:574)
what is the correct way to do this?
org.sql2o.converters.Converter