-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: newbie question : unable to execute query
PostPosted: Thu Feb 26, 2004 11:42 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 11:32 am
Posts: 32
Hi :
I am using hibernate-2.1 and trying to query Oracle 8i. I am able to connect to the database but my query fails ..and I get the following bunch of exceptions .Any pointers would be greatly appreciated.

[java] 10:24:35,531 WARN JDBCExceptionReporter:38 - SQL Error: 936, SQLState: 42000
[java] 10:24:35,546 ERROR JDBCExceptionReporter:46 - ORA-00936: missing expression

[java] 10:24:35,546 WARN JDBCExceptionReporter:38 - SQL Error: 936, SQLState: 42000
[java] 10:24:35,546 ERROR JDBCExceptionReporter:46 - ORA-00936: missing expression

[java] 10:24:35,546 ERROR JDBCExceptionReporter:38 - Could not execute query
[java] java.sql.SQLException: ORA-00936: missing expression

[java] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:170)
[java] at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1614)
[java] at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:811)
[java] at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1941)
[java] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2137
)
[java] at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.
java:404)
[java] at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.j
ava:344)
[java] at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
[java] at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java
:133)
[java] at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
[java] at net.sf.hibernate.loader.Loader.list(Loader.java:941)
[java] at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
[java] at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
[java] at org.hibernate.hibertest.Test.main(Test.java:28)
[java] Exception net.sf.hibernate.JDBCException: Could not execute query
[echo] for more examples, download the hibernate-examples package



my code is as follows :


SessionFactory sf ;
System.out.println("came here111" ) ;

Session session = null;

try{
System.out.println("came here222" ) ;
sf = new Configuration()
.addClass(eas_tl_employee.class)
.buildSessionFactory();

session = sf.openSession();
System.out.println("came here333" ) ;
/* the name of my table and my persistent class is eas_tl
List myList = session.createQuery(
"from eas_tl_employe"
).setMaxResults(10).list();


if (myList.size() > 0)
{

for (Iterator i = myList.iterator(); i.hasNext() ; )
{
eas_tl_employee nextemp = (eas_tl_employee) i.next();
System.out.println( "employeeID " + nextemp.getEmployeeID() +
"dateofBirth" + nextemp.getDateofBirth() );
}
}


else
{
System.out.println("Didn't find any records");
}
}catch(Exception e)
{
System.out.println("Exception " + e);
e.printStackTrace();
}



and my mapping is as follows :

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="org.hibernate.hibertest">

<class name="org.hibernate.hibertest.eas_tl_employee" table="eas_tl_employee">

<id name="employeeID" column="EMPLOYEE_ID" >
<generator class="assigned"/>
</id>
<property name="retirecodeID" column="Name" />
<property name="ssn" type="string"/>
<property name="dateofBirth" type="date"/>
<property name="oldSSN" type="string"/>
</class>
</hibernate-mapping>


My hibernate.properties file is as follows

hibernate.dialect net.sf.hibernate.dialect.OracleDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.username xxx
hibernate.connection.password yyy
hibernate.connection.url jdbc:oracle:oci8:@DEV


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 12:05 pm 
Beginner
Beginner

Joined: Thu Feb 26, 2004 11:32 am
Posts: 32
Hi :
figured out my mistake. My mapping file was screwed up.

splash


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.