Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't Load Data on JSP

 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some problem here. I want to select data by date.
My class is not in association, so I making Native SQL in my Dao Impl:


This is my controller :


and this is my code in JSP :


When I click to search data by Date, the no action, no get data, no print out data in log, and there's no sql in log.
I don't know where's the problem.
I try to exectue my SQL query in navicat apps, it's run well.

Thank's in advance, guys. :)
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Irliyanti Rahmadhani Lubis wrote:
When I click to search data by Date, the no action, no get data, no print out data in log, and there's no sql in log.


If you;re not getting anything logged on the server then it's quite possible you're not hitting the server at all.

Have you checked, using something like the dev tools for your browser, that a call is being made to the server? And with what parameters?
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked, using something like the dev tools for your browser, that a call is being made to the server? And with what parameters?


With JSP, I don't know how to check the bug in browser, but if that PHP I can see the error log with firebug.
is there any reference?
:)
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What browser are you using?

Most of them have developer tools accessible, usually with F12.
In Chrome, for example, there will be a Network tab that will show you what (if anything) is being sent to the server, and any responses.
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:What browser are you using?


I use Mozilla Firefox. Oh, Ok. I know it. but there's no problem with JS or other.
Now, I got error log in log apache, but.
When I click that Date the value is : Mon Oct 12 00:00:00 ICT 2015, I have casting it to Date with format dd/MM/yyyy. But, it still not work and I can't load data by Date it.
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it's hitting the server, which is good.
That output you see in your logs is simply the default format used by the toString method of Date. A Date object has no format.

So the issue is around this part of your query:


StartDate is a DATE at this point.
So comparing it with a TO_CHAR like that won't work, except by pure luck. It depends what the default format of a DATE is when converted.

You either ought to use a date range (BETWEEN midnight and midnight) or you want to pass in a String version of your StartDate using the same format.
I would prefer the former as the DB will be able to use its indexes, IMO.

Hope this makes some sense!
:)
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:So it's hitting the server, which is good.
That output you see in your logs is simply the default format used by the toString method of Date. A Date object has no format.

So the issue is around this part of your query:


StartDate is a DATE at this point.
So comparing it with a TO_CHAR like that won't work, except by pure luck. It depends what the default format of a DATE is when converted.


Hem. Okay. I got it. :D Thank's
But, can you help me a little again? :D
I'm making shortly SQL Query, like this :


The error is :

org.hibernate.QueryException: could not resolve property: LtklSubmitInfo of: gov.siapuppatk.model.LtklSubmitInfoDetail
org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
org.hibernate.persister.entity.AbstractEntityPersister.getPropertyType(AbstractEntityPersister.java:3439)
org.hibernate.loader.custom.CustomLoader.<init>(CustomLoader.java:151)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1688)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
gov.siapuppatk.dao.impl.LtklSubmitInfoDaoImpl.setDataTanggalTransaksi(LtklSubmitInfoDaoImpl.java:149)
gov.siapuppatk.service.LtklSubmitInfoService.loadDataTanggalTransaksi(LtklSubmitInfoService.java:133)
gov.siapuppatk.service.LtklSubmitInfoService$$FastClassByCGLIB$$d8bedee7.invoke(<generated>)
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:701)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:634)
gov.siapuppatk.service.LtklSubmitInfoService$$EnhancerByCGLIB$$45417895.loadDataTanggalTransaksi(<generated>)
gov.siapuppatk.controller.CekSubmitController.viewHistoryLtkl(CekSubmitController.java:127)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


Is not that LtklSubmitInfo has been initial in ?
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure.
That error seems to be saying that there isn't a LtklSubmitInfo property on the LtklSubmitInfoDetail class.
I'm guessin gthat it's around these two joins:


If that property doesn't exist then Hibernate can't join on it.
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Not sure.
That error seems to be saying that there isn't a LtklSubmitInfo property on the LtklSubmitInfoDetail class.
If that property doesn't exist then Hibernate can't join on it.


hem, I don't understand. :D
What the property? is that name of field in class? or what? :D
Actually, what the function of there?
Is not with JOIN table or class in SQL is enough?
B'cos, for the fisrt try, I don't make there. But the error :
Could not execute query

 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The addJoin method is telling Hibernate to join the two entities together.
So:

tells it to join the entity represented by 'a' (which is a LtklSubmitInfo) to the one represented by 'b' (which is a LtklSubmitInfoDetail)...and to join on the id of 'a' against the LtklSubmitInfo column of 'b'.

Does the LtklSubmitInfoDetail class have a LtklSubmitInfo column?
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:The addJoin method is telling Hibernate to join the two entities together.
So:

tells it to join the entity represented by 'a' (which is a LtklSubmitInfo) to the one represented by 'b' (which is a LtklSubmitInfoDetail)...and to join on the id of 'a' against the LtklSubmitInfo column of 'b'.

Does the LtklSubmitInfoDetail class have a LtklSubmitInfo column?


Yes, they have it. But it same.
It's not work. :(
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic