• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

org.hibernate.exception.SQLGrammarException: could not execute query

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Team ,

Please help here . i am unable to display the Task Information Please find the below classes & confg files and Db tables information.


SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hibernate: select this_.TASK_ID as TASK1_4_0_, this_.TASKCOMMENTS as TASKCOMM2_4_0_, this_.TASKDATE as TASKDATE4_0_, this_.IMPCOMMENTS as IMPCOMME4_4_0_, this_.NAME as NAME4_0_, this_.PRIPORTY as PRIPORTY4_0_, this_.TASKSTATUS) as TASKSTATUS7_4_0_, this_.TASKTIMESTAMP as TASKTIME8_4_0_, this_.TASKTYPE as TASKTYPE4_0_, this_.TASKUPDATETIME as TASKUPD10_4_0_, this_.TUPDATEDBY as TUPDATEDBY4_0_ from TASKINFO this_
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2536)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at com.iwinner.rms.dao.impl.TaskInfoDaoImpl.viewAllTasksInfo(TaskInfoDaoImpl.java:161)
at com.iwinner.rms.dao.impl.TaskInfoDaoImpl.main(TaskInfoDaoImpl.java:173)
Caused by: java.sql.SQLException: ORA-00923: FROM keyword not found where expected

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
at org.hibernate.loader.Loader.doQuery(Loader.java:802)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
... 7 more

My Entity Class ::

package com.iwinner.rms.model;
import java.sql.Timestamp;


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "TaskInfo")
public class TaskInfo implements java.io.Serializable {

private static final long serialVersionUID = 1L;
@Id
@Column(name = "TASK_ID")
private Integer taskId;

@Column(name = "TASK_NAME")
private String taskName;

@Column(name = "TASKDATE")
private Date taskDate;

@Column(name = "TASKCOMMENTS")
private String comments;

@Column(name = "TASKUPDATETIME")
private Timestamp taskUpdateTime;

@Column(name = "TUPDATEDBY")
private String taskUpdatedBy;

@Column(name = "TASK_PRIPORTY")
private String taskPriporty;

@Column(name = "TASKTIMESTAMP")
private Timestamp taskTime;

@Column(name = "IMPCOMMENTS")
private String taskImpComments;

@Column(name = "TASKTYPE")
private String taskType;

@Column(name = "TASKSTATUS)")
private String taskStatus;


sexXXXX & getXXXX

}
DB Table Name :
( TaskInfo) below columns

TASK_ID
TASK_NAME
TASKDATE
TASKCOMMENTS
TASKUPDATETIME
TUPDATEDBY
TASK_PRIPORTY
TASKTIMESTAMP
IMPCOMMENTS
TASKTYPE
TASKSTATUS

hibernate-cfg.xml

NOTE : i tried below dialect classes
i) org.hibernate.dialect.Oracle10gDialect ii) org.hibernate.dialect.OracleDialect
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<!-- Production DB Info -->
<property name="connection.url">jdbcracle:thin:@localhost:1521:xe</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="connection.username">rms_pro</property>
<property name="connection.password">rms_pro</property>
<!-- <property name="validationQuery">select 1 from dual</property>
--> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping resource="/com/st/mapping/Floor.hbm.xml"/> -->
<mapping class="com.iwinner.rms.model.Audit"></mapping>
<mapping class="com.iwinner.rms.model.Users"></mapping>
<mapping class="com.iwinner.rms.model.ItemInfo"></mapping>
<mapping class="com.iwinner.rms.model.UserRole"></mapping>
<mapping class="com.iwinner.rms.model.TaskInfo"></mapping>
<mapping class="com.iwinner.rms.model.URLSave"></mapping>
</session-factory>

</hibernate-configuration>

TaskDaoImpl class
public class TaskDaoImpl implements TaskDaoIF{

public List<TaskInfo> viewAllTasksInfo() throws DaoException {
LOGGER.info("***** start of viewAllTasksInfo() is processing ***** ") ;
List<TaskInfo> viewAllTasks=new ArrayList<TaskInfo>();
try{
/*Session session = HibernateUtils.getSession();
System.out.println("002");
Criteria criteria = session.createCriteria(TaskInfo.class);
viewAllTasks = criteria.list();
*/
Session session = HibernateUtils.getSession();
session.beginTransaction().begin();
Query query=session.createQuery(RMSConstants.SELECT_TASK_INFO);
viewAllTasks=query.list();
}catch(Exception e){
e.printStackTrace();
LOGGER.error("##### Error Inside viewAllTasksInfo() is processing ##### "+e.getMessage()) ;
}
LOGGER.info("***** end of viewAllTasksInfo() is processing ***** ") ;
return viewAllTasks;
}

public static void main(String[] args) throws Exception {
List<TaskInfo> viewAll=new ArrayList<TaskInfo>();
TaskInfoDaoImpl tD=new TaskInfoDaoImpl();
viewAll=tD.viewAllTasksInfo();

}

 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Remove the parenthesis in that name - it's a typo.
 
anji anjaiah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for very much Karthik Shiraly , you saved my time lot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!