Hibernate SQL Exception java.lang.StringIndexOutOfBoundsException: String index out of range

user3696143

I am writing below query to get record for today date

Session session = getSessionFactory().getCurrentSession();
DateTime todayAtMidnight = new DateTime().withTimeAtStartOfDay();
DateTime tomorrowAtMidnight = todayAtMidnight.plusDays(1);
Query query = session.getNamedQuery("findUsersOrder")
    .setTimestamp("todayAtMidnight", todayAtMidnight.toDate())
    .setTimestamp("tomorrowAtMidnight", tomorrowAtMidnight.toDate());
List<GroupTweetOrder> usersOrder= query.list();

and in Java class for his table

@NamedQueries({
    @NamedQuery(name = "findUsersOrder", query = "FROM GroupTweetOrder WHERE gtoAddedDate >= :todayAtMidnight and gtoAddedDate < :tomorrowAtMidnight")
})

But when ever i am trying to run this HSQL i am getting

Jun 23, 2014 5:13:11 PM com.sun.faces.context.AjaxExceptionHandlerImpl log
SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=formcontract:iconOnly, Message=java.lang.StringIndexOutOfBoundsException: String index out of range: 0
Jun 23, 2014 5:13:11 PM com.sun.faces.context.AjaxExceptionHandlerImpl log
SEVERE: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
javax.faces.event.AbortProcessingException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.lang.String.charAt(String.java:658)
    at org.hibernate.type.descriptor.java.CharacterTypeDescriptor.wrap(CharacterTypeDescriptor.java:79)
    at org.hibernate.type.descriptor.java.CharacterTypeDescriptor.wrap(CharacterTypeDescriptor.java:33)
    at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:66)
    at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:65)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:269)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:265)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:238)
    at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:357)
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2701)
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1541)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1473)
    at org.hibernate.loader.Loader.getRow(Loader.java:1373)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:640)
    at org.hibernate.loader.Loader.doQuery(Loader.java:850)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
    at org.hibernate.loader.Loader.doList(Loader.java:2447)
    at org.hibernate.loader.Loader.doList(Loader.java:2433)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)
    at org.hibernate.loader.Loader.list(Loader.java:2258)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1161)
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
    at com.ccc.spring.dao.GroupDistDAO.fetchTodayGroupOrder(GroupDistDAO.java:82)
    at com.ccc.spring.service.GroupDistService.fetchTodayGroupOrder(GroupDistService.java:40)
    at com.ccc.spring.service.GroupDistService$$FastClassBySpringCGLIB$$a552f952.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:711)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at com.ccc.spring.service.GroupDistService$$EnhancerBySpringCGLIB$$647c04d.fetchTodayGroupOrder(<generated>)
    at com.ccc.managedController.TweetDistributionManagedBean.sendGroupTweets(TweetDistributionManagedBean.java:175)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:264)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
    ... 31 more
user3696143

This issue is not coming due to date ....This issue due to character field in table for which i am using char as a data type so i made changes char datatype to TinyInt(1) Now this work fine

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

"Exception:java.lang.StringIndexOutOfBoundsException: String index out of range"

From Dev

Runtime Error for an anagram - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1

From Dev

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -3

From Dev

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 4

From Dev

Exception in thread "main java.lang.StringIndexOutOfBoundsException: String index out of range

From Dev

Runtime Error for an anagram - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1

From Dev

Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 8

From Dev

java.lang.StringIndexOutOfBoundsException: String index out of range: 12 in java

From Dev

java.lang.StringIndexOutOfBoundsException: String index out of range: 12 in java

From Dev

Java - java.lang.StringIndexOutOfBoundsException: String index out of range: 11

From Dev

"main" java.lang.StringIndexOutOfBoundsException: String index out of range: 17

From Dev

java.lang.StringIndexOutOfBoundsException: String index out of range: 4

From Dev

java.lang.StringIndexOutOfBoundsException: String index out of range: (again)

From Dev

java.lang.StringIndexOutOfBoundsException: String index out of range: -23 error

From Dev

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 5 at java.lang.String.charAt(String.java:646)

From Dev

curl errors: could not resolve host, java.lang.StringIndexOutOfBoundsException: String index out of range: -1

From Dev

Rebalance topology throws java.lang.StringIndexOutOfBoundsException: String index out of range: -1

From Dev

I am unable to solve this :java.lang.StringIndexOutOfBoundsException: String index out of range: 54

From Dev

Reading strings from lines in java - StringIndexOutOfBoundsException: String index out of range

From Dev

StringIndexOutOfBoundsException String index out of range error

From Dev

StringIndexOutOfBoundsException: String index out of range: 0 while reading a file

From Dev

SQL Exception: the index is out of range

From Dev

SQL Exception: the index is out of range

From Dev

string index out of bound exception, String index out of range

From Dev

string index out of bound exception, String index out of range

From Dev

Java - String index out of range

From Dev

Mongodb Exception String index out of range: -1

From Dev

java.sql.SQLException: Parameter index out of range - whitespaces in String

From Dev

Hibernate softdelete - column index out of range exception while soft delete

Related Related

  1. 1

    "Exception:java.lang.StringIndexOutOfBoundsException: String index out of range"

  2. 2

    Runtime Error for an anagram - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  3. 3

    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -3

  4. 4

    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 4

  5. 5

    Exception in thread "main java.lang.StringIndexOutOfBoundsException: String index out of range

  6. 6

    Runtime Error for an anagram - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  7. 7

    Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 8

  8. 8

    java.lang.StringIndexOutOfBoundsException: String index out of range: 12 in java

  9. 9

    java.lang.StringIndexOutOfBoundsException: String index out of range: 12 in java

  10. 10

    Java - java.lang.StringIndexOutOfBoundsException: String index out of range: 11

  11. 11

    "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 17

  12. 12

    java.lang.StringIndexOutOfBoundsException: String index out of range: 4

  13. 13

    java.lang.StringIndexOutOfBoundsException: String index out of range: (again)

  14. 14

    java.lang.StringIndexOutOfBoundsException: String index out of range: -23 error

  15. 15

    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 5 at java.lang.String.charAt(String.java:646)

  16. 16

    curl errors: could not resolve host, java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  17. 17

    Rebalance topology throws java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  18. 18

    I am unable to solve this :java.lang.StringIndexOutOfBoundsException: String index out of range: 54

  19. 19

    Reading strings from lines in java - StringIndexOutOfBoundsException: String index out of range

  20. 20

    StringIndexOutOfBoundsException String index out of range error

  21. 21

    StringIndexOutOfBoundsException: String index out of range: 0 while reading a file

  22. 22

    SQL Exception: the index is out of range

  23. 23

    SQL Exception: the index is out of range

  24. 24

    string index out of bound exception, String index out of range

  25. 25

    string index out of bound exception, String index out of range

  26. 26

    Java - String index out of range

  27. 27

    Mongodb Exception String index out of range: -1

  28. 28

    java.sql.SQLException: Parameter index out of range - whitespaces in String

  29. 29

    Hibernate softdelete - column index out of range exception while soft delete

HotTag

Archive