0
Je reçois l'erreur suivante. Ne pas comprendre pourquoi cela se passe. Aussi j'ai vérifié DB il semble bien.Hibernate exception: org.hibernate.exception.SQLGrammarException: impossible d'exécuter la requête
Hibernate: select customer0_.CustomerId as CustomerId0_, customer0_.CustomerAlias as Customer2_0_ from FF_REFERENCE.dbo.Customer customer0_ where customer0_.CustomerId=?
org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: [Macromedia][Sybase JDBC Driver]**Invalid column name: CustomerId0_**
Mon POJO est:
public class Customer implements java.io.Serializable {
// Fields
private String customerId;
private String customerAlias;
}
HBM:
<hibernate-mapping>
<class name="com.pojo.reference.Customer" table="Customer" >
<id name="customerId" column ="CustomerId" length="18" />
<property name="customerAlias" type="java.lang.String">
<column name="CustomerAlias" length="18" />
</property>
La requête J'utilise est:
public List findByProperty(String propertyName, Object value,String region) {
try {
String queryString = "from Customer as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
}
}
Je fais appel à l'aide:
custDao.findByProperty("customerId", custName, region);
Salut. Quand vous dites prendre le hbm du mauvais endroit. Pourriez-vous élaborer? parce que je pense que je peux avoir le même problème –