views:

1344

answers:

1

I am getting the following error. Not getting clue why is it coming. Also i checked DB it looks fine.

Hibernate: select customer0_.CustomerId as CustomerId0_, customer0_.CustomerAlia s 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_

My pojo is

public class Customer implements java.io.Serializable {

// Fields

private String customerId;
private String customerAlias;

}

hbm is

<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>

The query i am using is

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) {
   }
}

I am calling using

custDao.findByProperty("customerId", custName, region);
+1  A: 

got the answer. the deployed war was taking hbm from the wrong place...

harshit