I have a legacy table that has ridiculous number of columns and I am trying to limit the number of columns hibernate populates. If I run just from the "from" clause to the end, it works fine, loads every column, but when I add "Select a.col1, a.col2..." etc., I get back an object array instead of the instance of the bean.
I tried adding a result transformer, but it seems to think that the first column is named "0". I suppose it's already broken by the time the result transformer comes into the picture. I wondered if maybe there was a case mismatch, so I turned everything uppercase, but that didn't help.
UPDATE: Here's the SQL:
Select a.SZ_ABND_NO, a.ASSET_VAL, a.FO_TYP, a.ASSET_ID, a.AGCY_RGN_CD, a.LIT_AGCY_CD, a.ASSET_TYP, a.SZ_AGCY_CD, a.SUB_OFC_ID, a.OFC_ID, a.CA_ID_AGCY, a.PROC_DIST from FlatAssetT a where a.ASSET_ID in (:assetList) order by a.ASSET_ID
The bean is enormous. Those 12 columns are among hundreds (yes plural). I'll give a selected snippet of the bean though.
@Entity
@Table(name = "FLATASSET_T", schema="K702PRDR")
public class FlatAssetT {
@Column(name="ADPT_DT", nullable=false)
private Date ADPT_DT;
@Id
@Column(name="ASSET_ID", nullable=false)
private String ASSET_ID;
@Column(name="ASSET_ID_TYP", nullable=false)
private String ASSET_ID_TYP;
@Column(name="SZ_ABND_NO", nullable=false)
private String SZ_ABND_NO;
[etc.]
public String getSZ_ABND_NO() {
return SZ_ABND_NO;
}
public void setSZ_ABND_NO(String arg) {
this.SZ_ABND_NO=arg;
}
public String getASSET_ID() {
return ASSET_ID;
}
public void setASSET_ID(String arg) {
this.ASSET_ID=arg;
}
public Date getADPT_DT() {
return ADPT_DT;
}
public void setADPT_DT(Date arg) {
this.ADPT_DT=arg;
}
public String getASSET_ID_TYP() {
return ASSET_ID_TYP;
}
public void setASSET_ID_TYP(String arg) {
this.ASSET_ID_TYP=arg;
}
[etc.]
}