Hello
I have an java Object ‘Person’ with 3 properties firstname,lastname and username. I have an Oracle Store procedure returning a Resultset with the 3 column. All works fine for that. Now I have another StoreProcedure that will only return firstname and lastname but not username.
I get the following error : « could not read column value from result set username. »
Hibernate tries to fetch the username property from the resultset. If I remove the property username, then it works.
My Config
<sql-query name="normalise" callable="true" >
<return alias="val" class="com.nbfg.sipc.model.Person">
<return-property name="firstname" column="FIRST_NAME"/>
<return-property name="lastname" column="LASTNAME_NAME"/>
</return>
{call SCHSIPC.PKG_SIPC_APP.PRC_SIPC_NORMALISE_RS(?, ?, ?, ?, ?) }
</sql-query>
My Pojo (no annotation)
@Entity
public class Person {
private String firstname;
private String lastname;
private String username;
...
The call:
private Value call(String app, String cat, String col, String valeure, String query) {
try {
Query q = getSessionFactory().openStatelessSession().getNamedQuery(query);
q.setString(0, app).setString(1, cat).setString(2, col).setString(3, valeure);
return (Person) q.list().get(0);
} catch (org.hibernate.QueryTimeoutException ex) {
throw new IllegalArgumentException(ex.getCause().getMessage());
}
}
It all works fine if I remove the Proprety username from my Pojo. I can I reuse the same PoJo?
Thank you