473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Hibernate

Hi

Already my application in Struts using JDBC.At present my application is implemented in Struts with hibernate
So i am not changing the SQL queries converting to the like this

String sql4="select max(sed.SubexpenseId) from hiber.SubexpenseDet sed";
List query1 = session.createSQLQuery(sql4).addEntity(SubexpenseD et.class).list();
Iterator it1 = query1.iterator();
it1.hasNext();
SubexpenseDet set1 = (SubexpenseDet) it1.next();
subexpenseid=set1.getSubexpenseId();


at the retriving time i got the Exception like this

Hibernate: select max(sed.SubexpenseId) from hiber.SubexpenseDet sed
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverte
ava:67)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionH
er.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:214 8)
at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(Cust omLoader.java:11
at org.hibernate.impl.SessionImpl.listCustomQuery(Ses sionImpl.java:16

at org.hibernate.impl.AbstractSessionImpl.list(Abstra ctSessionImpl.ja
142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl. java:164)
at food.FoodDAO.insertBreakFastData(FoodDAO.java:111)
at food.FoodAction.execute(FoodAction.java:57)
at org.apache.struts.action.RequestProcessor.processA ctionPerform(Req
tProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process( RequestProcessor
va:236)
at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:
6)
at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:4

at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(A
icationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(Applicati
ilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapp
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardConte
alve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValv
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValv
ava:105)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngine
ve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.
a:148)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.j
:856)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.pr
ssConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEn
int.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(Leader
lowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(Thre
ool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorExceptio n: Table 'hiber.
expensedet' doesn't exist
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:15 73)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3176)
at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement
va:1153)
at com.mysql.jdbc.PreparedStatement.executeQuery(Prep aredStatement.ja
1266)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(Ab stractBatcher.ja
139)
at org.hibernate.loader.Loader.getResultSet(Loader.ja va:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:66 2)
at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections
ader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:214 5)
... 28 more


what is the problem in my sql query and the code

please help me

thank u
Jun 26 '07 #1
1 3545
r035198x
13,262 8TB
Please do not post questions in the articles section.
Moved to the forum.
Jun 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Keith Simeon | last post by:
Hello all, I've recently started playing with Hibernate, and have a question regarding many-to-many relationships using a join or cross table (I've also heard these referred to as a transition...
6
rsrinivasan
by: rsrinivasan | last post by:
Hi all, I am using Hibernate framework in my project. This is my configuration in my "hibernate.cfg.xml" file. <property name="hibernate.c3p0.max_size">25</property> <property...
3
by: altafur | last post by:
hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query: SELECT distinct...
0
by: neuraljay | last post by:
hi everyone. I am trying to build a jsp using webwork, hibernate and mysql. And right now I am doing its unit testing. Everytime I run the test I am getting this error: Error JDBC exception on...
1
by: ashi1290 | last post by:
I am getting this error..... Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:120)...
2
oll3i
by: oll3i | last post by:
I have hibernate plugin for eclipse (org.hibernate.eclipse_3.2.3.GA) it came together with eclipse europa , but when i do the import to use hibernate import org.hibernate.Session; import...
15
oll3i
by: oll3i | last post by:
Thank you for the last post :) now another problem when i flush the session hibernate throws nullpointerexception my code looks as follows import org.hibernate.Session; import...
1
by: CatchSandeepVaid | last post by:
I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ... In hibernate, presently one-to-one associations are fetched non-lazily... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.