Dongyi Lin created CXF-8942:
-------------------------------

             Summary: When OdataParser parses a date-time string to Instant, 
time is ignored and is always 00:00:00
                 Key: CXF-8942
                 URL: https://issues.apache.org/jira/browse/CXF-8942
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 4.0.3
            Reporter: Dongyi Lin


Hi,

I use ODataParser of JAX-RS Search to parse odata filter into SearchCondition, 
which then accepts JPACriteriaQueryVisitor, to build TypedQuery. However, the 
parser seems to ignore the time part in a date-time string when the target 
field is of Java Instant type. The resulting condition always has 00:00:00 in 
the time part regardless of the input.

Here is an example with a made-up BookEntity, which contains an Instant field:

 
{code:java}
public class BookEntity {
   private int id;
   private Instant publishedDate;
}
final String queryFilter = "publishedDate ge '2023-07-01T18:00:00Z'";

final JPACriteriaQueryVisitor<BookEntity, BookEntity> jpaCriteriaQueryVisitor =
new JPACriteriaQueryVisitor<>(entityManager, BookEntity.class, 
BookEntity.class);

final ODataParser<BookEntity> oDataParser = new ODataParser<>(BookEntity.class);

final SearchCondition<BookEntity> searchCondition = 
oDataParser.parse(queryFilter);

searchCondition.accept(jpaCriteriaQueryVisitor);{code}
 
 
The resulting property value of the search condition is always 
2023-07-01T00:00:00Z regardless of the time value in queryFilter. Could you 
please help me with this problem?
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to