0

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

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

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

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Hi. When you say taking the hbm from the wrong place. Could you elaborate?? because I think I may have the same problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.