Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:52:06+00:00 2026-06-10T19:52:06+00:00

I have created a portlet, via Service Builder, that stores some user data, as

  • 0

I have created a portlet, via Service Builder, that stores some user data, as well as a date.

relevant portion of my service.xml file

<entity name="ServiceAgreement" local-service="true" remote-service="false">
    <column name="agreementId" type="long" primary="true"></column>
    <column name="agreementVersion" type="double"></column>
    <column name="userId" type="long"></column>
    <column name="agreementTimestamp" type="Date"></column><!-- column w/ the trouble -->
    <column name="groupId" type="long"></column>
    <column name="companyId" type="long"></column>
    <order by="asc">
        <order-column name="agreementTimestamp"></order-column>
    </order>
    <finder name="G_AT" return-type="Collection">
        <finder-column name="groupId"></finder-column>
        <finder-column name="agreementTimestamp"></finder-column>
    </finder>
    <finder name="SignedDate" return-type="Collection">
        <finder-column name="agreementTimestamp"></finder-column>
    </finder>
...

I am currently writing another portlet that will be a reporting portlet for the data stored in this first portlet.

The trouble I’m having is when I perform a search by date, using the tag, I am not getting any responses from the DB for dates that I know are in there. I have tracked the problem down to the fact that they ‘findbysignedDate’ method that ServiceBuilder built, searching by date, down to the millisecond!

The record I want to retrieve:
Record to be retrieved
For example, my reporting portlet contains:

int month = Integer.parseInt(request.getParameter("dateMonth"));
int day = Integer.parseInt(request.getParameter("dateDay"));
int year = Integer.parseInt(request.getParameter("dateYear"));
GregorianCalendar cal = new GregorianCalendar();
cal.clear();
cal.set(year, month, day);
Date signedDate = cal.getTime();

try {
   if(signedDate == null || signedDate.getTime() < 0) {
     throw new PortalException("Invalid date input provided.");
} else {
    _log.debug("Signed Date: " + signedDate.toString());

    //get TOS data
    JSONArray tosArray = LiferayHelper.getTOSsBySignedDate(signedDate);
...

And nothing is returned in ‘tosArray’.
However, if I write it like this:

int month = Integer.parseInt(request.getParameter("dateMonth"));
int day = Integer.parseInt(request.getParameter("dateDay"));
int year = Integer.parseInt(request.getParameter("dateYear"));
GregorianCalendar cal = new GregorianCalendar();
cal.clear();
cal.set(year, month, day,18,49,15); //getting REALLY specific here...
cal.add(Calendar.MILLISECOND, 958);
Date signedDate = cal.getTime();

try {
   if(signedDate == null || signedDate.getTime() < 0) {
     throw new PortalException("Invalid date input provided.");
} else {
    _log.debug("Signed Date: " + signedDate.toString());

    //get TOS data
    JSONArray tosArray = LiferayHelper.getTOSsBySignedDate(signedDate);
...

Then tosArray contains the correct data.

I just want to pull back all data for a single day (24-hour period). Does anyone know if there is a built-in way around this? Or do I need to rewrite my service.xml file? Am I stuck having to write my own search method?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:52:07+00:00Added an answer on June 10, 2026 at 7:52 pm

    The answer is to use the custom queries that Service Builder will build for you. Found this at the end of Chapter 7 of Liferay in Action.

    A brief overview is available on the Liferay site.
    http://www.liferay.com/community/wiki/-/wiki/Main/Service+Builder+Finders

    Just be aware of the strict naming convention contract that Liferay enforces for these Finders. I struggled for almost a whole day trying to get service generator to automatically build my new finder classes, only to discover that it was failing because I didn’t name my finder what Service Builder was expecting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some JQuery that will expand a div 'popup' on hover and
Have created a custom navigation menu in wordpress that has some pages and some
We have created a portlet. We then went through some pain to move images
I have created a my-services-portlet in which i have AbcService, which I am calling
I'm trying to override a JSP in Liferay 6.1, namely html/portlet/enterprise_admin/settings/authentication.jsp. I have created
I have created an android application that calls (using kSOAP library) a SOAP based
I have created a function that shows/hides different messages according to a combination of
Have created simple Ajax enabled contact forms before that have around 12 fields -
I have created a simple web service called TimeServerBean . It's working properly, the
have created REST service using servicestack and in post request I have return object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.