Friday, 15 May 2015

java - Converting date as timestamp while selecting using Hibernate APIs -


We have a GUI application that sends 40 parameters to DB. Based on these parameters a dynamic query is created to fetch data. The number of selected areas is the same, only where the situation is different. The Hibernate Criteria API is used to create dynamic queries. We are using SQLMX as a database running on the HP nonstop server. Some dates need to be stored as 0001-01-01 Now, when selecting this field (DATE data type), the application displays as 2001-01-01. When the query runs from the razor SQL, then we are seeing the wrong results. I can solve this problem by selecting "Problems in the form of timestamps from the table" (cast (date 1). It gives the correct date, but with the timestamp, this is fine. In this Java application, I suggested to the project team to use the NominalNative Queries, in which the TIMESTAMP formation as a CAST is specified in the query. Later, I came to know that the team called the questionnaire Can not use because the queries are in dynamic nature (where position can contain 1 or 5 or any clause). Trying to use temporal.DATE annotation which I have seen, we have to put date in the timestamp When selecting the self, only the variable is called setMethod and if we do not cast it while selecting, the value of 0001-01-01 changes is 2001-01-01. Is there any way that we can query Implementing Can SQL implement (similar_date in Oracle) be executed before?


No comments:

Post a Comment