Since a few weeks I have a problem to display a sql query. The problem appeared when I add at my sql query "left join" I have this in one of my class:
List<Movimien> listaDeMovimientos = session.createQuery("select m.cfech, m.ccuen,m.cimpo,m.cconc,c.cdesc from Movimien m\n" +
" left join m.cuenta c where m.ccuen=c.ccuen").list();
and in my jsf view, I get this error :
ene 22, 2016 4:37:13 PM com.sun.faces.context.ExceptionHandlerImpl log 1100: JSF1073: se ha interceptado java.lang.NumberFormatException durante el procesamiento de RENDER_RESPONSE 6 : UIComponent-ClientId=, Mensaje=For input string: "cfech" Hibernate: select movimien0_.cfech as col_0_0_, movimien0_.ccuen as col_1_0_, movimien0_.cimpo as col_2_0_, movimien0_.cconc as col_3_0_, cuenta1_.cdesc as col_4_0_ from movimien movimien0_ left outer join cuentas cuenta1_ on movimien0_.ccuen=cuenta1_.ccuen where movimien0_.ccuen=cuenta1_.ccuen Hibernate: select movimien0_.cfech as col_0_0_, movimien0_.ccuen as col_1_0_, movimien0_.cimpo as col_2_0_, movimien0_.cconc as col_3_0_, cuenta1_.cdesc as col_4_0_ from movimien movimien0_ left outer join cuentas cuenta1_ on movimien0_.ccuen=cuenta1_.ccuen where movimien0_.ccuen=cuenta1_.ccuen ene 22, 2016 4:37:13 PM com.sun.faces.context.ExceptionHandlerImpl log 1100: For input string: "cfech" java.lang.NumberFormatException: For input string: "cfech"
But when I debug the code and I can't see any error. Here one extract of different classes, maybe there are a bad interpretation of how apply hibernate?
Class cuenta:
@Entity
@Table(name = "movimien")
public class Movimien implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int ciden;
private Date cfech;
private short ccuen;
private double cimpo;
private String cconc;
@ManyToOne
@JoinColumn (name="ccuen" , insertable=false, updatable=false)
private Cuenta cuenta;
public Cuenta getCuenta() {
return cuenta;
}
public void setCuenta(Cuenta cuenta) {
this.cuenta = cuenta;
}
public Movimien(){
Date date = new Date();
this.ccuen=0;
this.cimpo=0;
this.cconc="";
this.cfech=date;
}
public Movimien(Date cfech, short ccuen, double cimpo, String cconc){
this.cfech=cfech;
this.ccuen=ccuen;
this.cimpo=cimpo;
this.cconc=cconc;
}
public int getCiden() {
return ciden;
}
public void setCiden(int ciden) {
this.ciden = ciden;
}
public Date getCfech() {
return cfech;
}
public void setCfech(Date cfech) {
this.cfech = cfech;
}
public short getCcuen() {
return ccuen;
}
public void setCcuen(short ccuen) {
this.ccuen = ccuen;
}
public double getCimpo() {
return cimpo;
}
public void setCimpo(double cimpo) {
this.cimpo = cimpo;
}
public String getCconc() {
return cconc;
}
public void setCconc(String cconc) {
this.cconc = cconc;
}
}
Class movimien:
@Entity
@Table(name = "movimien")
public class Movimien implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int ciden;
private Date cfech;
private short ccuen;
private double cimpo;
private String cconc;
@ManyToOne
@JoinColumn (name="ccuen" , insertable=false, updatable=false)
private Cuenta cuenta;
public Cuenta getCuenta() {
return cuenta;
}
public void setCuenta(Cuenta cuenta) {
this.cuenta = cuenta;
}
public Movimien(){
Date date = new Date();
this.ccuen=0;
this.cimpo=0;
this.cconc="";
this.cfech=date;
}
public Movimien(Date cfech, short ccuen, double cimpo, String cconc){
this.cfech=cfech;
this.ccuen=ccuen;
this.cimpo=cimpo;
this.cconc=cconc;
}
public int getCiden() {
return ciden;
}
public void setCiden(int ciden) {
this.ciden = ciden;
}
public Date getCfech() {
return cfech;
}
public void setCfech(Date cfech) {
this.cfech = cfech;
}
public short getCcuen() {
return ccuen;
}
public void setCcuen(short ccuen) {
this.ccuen = ccuen;
}
public double getCimpo() {
return cimpo;
}
public void setCimpo(double cimpo) {
this.cimpo = cimpo;
}
public String getCconc() {
return cconc;
}
public void setCconc(String cconc) {
this.cconc = cconc;
}
}
Any help is welcome. Thanks in advance!