Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
no value return in searching date range
johnchris constantino
Greenhorn
Posts: 1
posted 2 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please help me. This is
Java
MVC hibernate.
This is my view:
<form> from <form:input path="startDt" name= "search" type= "date" style="box-sizing:border-box; height:30px;"/> to <form:input path="endDt" name= "search" type= "date" style="box-sizing:border-box; height:30px"/> <input type= "submit" class="btn btn-success" style=height:30px;/> </form>
This is DAO/Hibernate
if(sched.getStartDt()!=null && sched.getEndDt()!=null) { dynamicSql.append("and DATE_FORMAT(ds.deliveryDate,'%y-%M-%d') between (:startDt) AND (:endDt)) "); //getSession().createQuery(hql).setParameter("date1", "%"+sched.getDeliveryDate()+"%").setParameter("date2","%"+sched.getDeliveryDate()+"%").list(); } if(sched.getStartDt()!=null && sched.getEndDt()!=null){ query.setParameter("startDt","%"+sched.getStartDt()+"%").setParameter("endDt","%"+ sched.getEndDt()+"%"); queryCount.setParameter("startDt", "%"+sched.getStartDt()+"%"); queryCount.setParameter("endDt", "%"+sched.getEndDt()+"%"); } Integer count = Integer.parseInt(queryCount.list().get(0).toString()); List<DeliverySchedule> results = query.list(); map.put(KEY_COUNT, count); map.put(KEY_LIST, results); return map;
And here is the Model
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) private Date deliveryDate; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) private LocalDate startDt; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) private LocalDate endDt; @Transient public LocalDate getStartDt() { return startDt; } public void setStartDt(LocalDate startDt) { this.startDt = startDt; } @Transient public LocalDate getEndDt() { return endDt; } public void setEndDt(LocalDate endDt) { this.endDt = endDt; }
I don't know why there's no value returning for searching.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Hibernate Select - Criteria with a Date
Pagination Problem
Calculate number of days between two dates
is that any utility class that help compare date within start and end date ?
spring Date update and auto populate
More...