This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Issues with getHibernateTemplate().find() method

Mar 2nd, 2007, 02:12 PM

I have a simple method in my DAO class as follows:
public List getAll() {
return getHibernateTemplate().find("FROM ADVISOR_CONVERSION");
}
If I enable the show_sql property as true
<prop key="hibernate.show_sql">true</prop>
This is the SQL I get in the logs:
Hibernate: select from
And this obviously generates this exception:
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not execute query; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-00936: missing expression

Comment

The database design is fixed and I cannot change it. All the tables have an underscore in them e.g. ADVISOR_CONVERSION and the columns in them also have an underscore in their names e.g. ADVISOR_ID and LEGACY_NAME. What should be the corresponding POJO for these tables? Is this correct?
public class Advisor_Conversion {
private java.lang.Long advisor_id;
private String legacy_name;

I don't think this has anything to do with the entity. It's simply that Hibernate can't see the table. Are you logging in with the same username and password? Are you connecting to the same tablespace/schema? Do you have permission to see the table?