473,626 Members | 3,389 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hibernate

2 New Member
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.Subexpe nseId) from hiber.Subexpens eDet sed";
List query1 = session.createS QLQuery(sql4).a ddEntity(Subexp enseDet.class). list();
Iterator it1 = query1.iterator ();
it1.hasNext();
SubexpenseDet set1 = (SubexpenseDet) it1.next();
subexpenseid=se t1.getSubexpens eId();


at the retriving time i got the Exception like this

Hibernate: select max(sed.Subexpe nseId) from hiber.Subexpens eDet sed
org.hibernate.e xception.SQLGra mmarException: could not execute query
at org.hibernate.e xception.SQLSta teConverter.con vert(SQLStateCo nverte
ava:67)
at org.hibernate.e xception.JDBCEx ceptionHelper.c onvert(JDBCExce ptionH
er.java:43)
at org.hibernate.l oader.Loader.do List(Loader.jav a:2148)
at org.hibernate.l oader.Loader.li stIgnoreQueryCa che(Loader.java :2029)
at org.hibernate.l oader.Loader.li st(Loader.java: 2024)
at org.hibernate.l oader.custom.Cu stomLoader.list (CustomLoader.j ava:11
at org.hibernate.i mpl.SessionImpl .listCustomQuer y(SessionImpl.j ava:16

at org.hibernate.i mpl.AbstractSes sionImpl.list(A bstractSessionI mpl.ja
142)
at org.hibernate.i mpl.SQLQueryImp l.list(SQLQuery Impl.java:164)
at food.FoodDAO.in sertBreakFastDa ta(FoodDAO.java :111)
at food.FoodAction .execute(FoodAc tion.java:57)
at org.apache.stru ts.action.Reque stProcessor.pro cessActionPerfo rm(Req
tProcessor.java :431)
at org.apache.stru ts.action.Reque stProcessor.pro cess(RequestPro cessor
va:236)
at org.apache.stru ts.action.Actio nServlet.proces s(ActionServlet .java:
6)
at org.apache.stru ts.action.Actio nServlet.doPost (ActionServlet. java:4

at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:709)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:802)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(A
icationFilterCh ain.java:252)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licati
ilterChain.java :173)
at org.apache.cata lina.core.Stand ardWrapperValve .invoke(Standar dWrapp
alve.java:213)
at org.apache.cata lina.core.Stand ardContextValve .invoke(Standar dConte
alve.java:178)
at org.apache.cata lina.core.Stand ardHostValve.in voke(StandardHo stValv
ava:126)
at org.apache.cata lina.valves.Err orReportValve.i nvoke(ErrorRepo rtValv
ava:105)
at org.apache.cata lina.core.Stand ardEngineValve. invoke(Standard Engine
ve.java:107)
at org.apache.cata lina.connector. CoyoteAdapter.s ervice(CoyoteAd apter.
a:148)
at org.apache.coyo te.http11.Http1 1Processor.proc ess(Http11Proce ssor.j
:856)
at org.apache.coyo te.http11.Http1 1Protocol$Http1 1ConnectionHand ler.pr
ssConnection(Ht tp11Protocol.ja va:744)
at org.apache.tomc at.util.net.Poo lTcpEndpoint.pr ocessSocket(Poo lTcpEn
int.java:527)
at org.apache.tomc at.util.net.Lea derFollowerWork erThread.runIt( Leader
lowerWorkerThre ad.java:80)
at org.apache.tomc at.util.threads .ThreadPool$Con trolRunnable.ru n(Thre
ool.java:684)
at java.lang.Threa d.run(Unknown Source)
Caused by: com.mysql.jdbc. exceptions.MySQ LSyntaxErrorExc eption: Table 'hiber.
expensedet' doesn't exist
at com.mysql.jdbc. SQLError.create SQLException(SQ LError.java:936 )
at com.mysql.jdbc. MysqlIO.checkEr rorPacket(Mysql IO.java:2870)
at com.mysql.jdbc. MysqlIO.sendCom mand(MysqlIO.ja va:1573)
at com.mysql.jdbc. MysqlIO.sqlQuer yDirect(MysqlIO .java:1665)
at com.mysql.jdbc. Connection.exec SQL(Connection. java:3176)
at com.mysql.jdbc. PreparedStateme nt.executeInter nal(PreparedSta tement
va:1153)
at com.mysql.jdbc. PreparedStateme nt.executeQuery (PreparedStatem ent.ja
1266)
at org.hibernate.j dbc.AbstractBat cher.getResultS et(AbstractBatc her.ja
139)
at org.hibernate.l oader.Loader.ge tResultSet(Load er.java:1669)
at org.hibernate.l oader.Loader.do Query(Loader.ja va:662)
at org.hibernate.l oader.Loader.do QueryAndInitial izeNonLazyColle ctions
ader.java:224)
at org.hibernate.l oader.Loader.do List(Loader.jav a:2145)
... 28 more


what is the problem in my sql query and the code

please help me

thank u
Jun 26 '07 #1
1 3563
r035198x
13,262 MVP
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
18521
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 tables). Given the following table structures : |------| |-------| |------| |a | | a_b | | b |
6
1873
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 name="hibernate.c3p0.min_size">3</property> <property name="hibernate.c3p0.timeout">5000</property> <!-- seconds --> <property name="hibernate.c3p0.max_statements">0</property> <property name="hibernate.c3p0.acquire_increment">3</property>...
3
3003
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 a.process_id, a.name name, a.category_id,c.parent_id FROM tbl_process_master a, tbl_category c where (lower(a.name) like :searchString or lower(a.description) like :searchString or lower(a.meta_tag) like :searchString ) and a.status=:status and...
0
6509
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 Hibernate data access; nested exception is org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is...
1
4055
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) at com.author.hbn.HibernateUtil.<clinit>(HibernateUtil.java:12) at com.author.app.Abhi.main(Abhi.java:13) Configuration file looks like this <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration SYSTEM...
2
2108
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 org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; eclipse says it can not be resolved Thank YOU
15
25986
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 org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration;
1
4745
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 know that this is done because, hibernate requires to fire 1 sql to find whether proxy can be created or not... and if it has to fire 1 sql, then why not to load one-to-one object itself in 1 sql instead of creating proxy of it (in 1 sql). ...
0
8268
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8641
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.