• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem retrieving data from the database using hibernate

 
S.R.K.Vivek Raju
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I using hibernate3 as the ORM and mysql as the database.I am saving data from one form into the database and retrieving this data on a different page in a table. The first time i save ,the data gets stored to the database and it gets retrieved on the other page.

But when i do it the second time it gives the String index out of range: 0
exception.

The complete error is as follows:-
***************************************************************************
14:21:28,218 INFO [STDOUT] Exception String index out of range: 0
14:21:28,218 INFO [STDOUT] java.lang.StringIndexOutOfBoundsException: String index out
of range: 0
14:21:28,218 INFO [STDOUT] at java.lang.String.charAt(String.java:444)
14:21:28,218 INFO [STDOUT] at org.hibernate.type.CharacterType.get(CharacterType.j
ava:28)
14:21:28,218 INFO [STDOUT] at org.hibernate.type.NullableType.nullSafeGet(Nullable
Type.java:62)
14:21:28,218 INFO [STDOUT] at org.hibernate.type.NullableType.nullSafeGet(Nullable
Type.java:53)
14:21:28,218 INFO [STDOUT] at org.hibernate.type.AbstractType.hydrate(AbstractType
.java:70)
14:21:28,218 INFO [STDOUT] at org.hibernate.persister.BasicEntityPersister.hydrate
(BasicEntityPersister.java:1550)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.loadFromResultSet(Loader
.java:817)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.instanceNotYetLoaded(Loa
der.java:775)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.getRow(Loader.java:687)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.getRowFromResultSet(Load
er.java:280)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.doQuery(Loader.java:368)

14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.doQueryAndInitializeNonL
azyCollections(Loader.java:195)
14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.doList(Loader.java:1361)

14:21:28,218 INFO [STDOUT] at org.hibernate.loader.Loader.list(Loader.java:1344)
14:21:28,218 INFO [STDOUT] at org.hibernate.hql.classic.QueryTranslatorImpl.list(Q
ueryTranslatorImpl.java:876)
14:21:28,218 INFO [STDOUT] at org.hibernate.impl.SessionImpl.list(SessionImpl.java
:994)
14:21:28,218 INFO [STDOUT] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)

14:21:28,218 INFO [STDOUT] at com.dao.GroupsDAO.addGroup(GroupsDAO.java:56)
14:21:28,218 INFO [STDOUT] at com.actions.GroupHandleAction.executeSave(GroupHandl
eAction.java:120)
14:21:28,218 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
14:21:28,218 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMe
thodAccessorImpl.java:39)
14:21:28,218 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Dele
gatingMethodAccessorImpl.java:25)
14:21:28,218 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
14:21:28,218 INFO [STDOUT] at org.apache.struts.actions.DispatchAction.dispatchMet
hod(DispatchAction.java:276)
14:21:28,218 INFO [STDOUT] at org.apache.struts.actions.LookupDispatchAction.execu
te(LookupDispatchAction.java:162)
14:21:28,218 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.processAct
ionPerform(RequestProcessor.java:421)
14:21:28,218 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.process(Re
questProcessor.java:226)
14:21:28,218 INFO [STDOUT] at org.apache.struts.action.ActionServlet.process(Actio
nServlet.java:1164)
14:21:28,218 INFO [STDOUT] at org.apache.struts.action.ActionServlet.doPost(Action
Servlet.java:415)
14:21:28,218 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.j
ava:717)
14:21:28,218 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.j
ava:810)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.inte
rnalDoFilter(ApplicationFilterChain.java:237)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFi
lter(ApplicationFilterChain.java:157)
14:21:28,218 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFil
ter(ReplyHeaderFilter.java:75)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.inte
rnalDoFilter(ApplicationFilterChain.java:186)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFi
lter(ApplicationFilterChain.java:157)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:214)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:104)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(Sta
ndardPipeline.java:520)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke
Internal(StandardContextValve.java:198)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:152)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:104)
14:21:28,218 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.i
nvoke(CustomPrincipalValve.java:44)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:102)
14:21:28,218 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationVal
ve.invoke(SecurityAssociationValve.java:169)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:102)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(Sta
ndardPipeline.java:520)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(St
andardHostValve.java:137)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:104)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(E
rrorReportValve.java:118)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:102)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(Sta
ndardPipeline.java:520)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:109)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invoke
Next(StandardValveContext.java:104)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(Sta
ndardPipeline.java:520)
14:21:28,218 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(Contai
nerBase.java:929)
14:21:28,218 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(Coyo
teAdapter.java:160)
14:21:28,234 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Htt
p11Processor.java:799)
14:21:28,234 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11Connec
tionHandler.processConnection(Http11Protocol.java:705)
14:21:28,234 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Poo
lTcpEndpoint.java:577)
14:21:28,234 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRun
nable.run(ThreadPool.java:683)
14:21:28,234 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)
**************************************************************************
If anybody has ever exprienced such an error please advice,

Thanks in advance
With Regards
S.R.K.Vivek Raju.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic