josehernandezfintecheandomx commented on code in PR #2446:
URL: https://github.com/apache/fineract/pull/2446#discussion_r929039230
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java:
##########
@@ -160,23 +161,32 @@ public String generateJsonFromGenericResultsetData(final
GenericResultsetData gr
if (currColType == null && colType.equalsIgnoreCase("DATE")) {
currColType = "DATE";
}
+ if (currColType == null &&
colType.equalsIgnoreCase("DATETIME")) {
+ currColType = "DATETIME";
+ }
currVal = row.get(j);
if (currVal != null && currColType != null) {
if (currColType.equals("DECIMAL") ||
currColType.equals("INTEGER")) {
writer.append(currVal);
} else {
if (currColType.equals("DATE")) {
- final LocalDate localDate =
LocalDate.parse(currVal);
+ final LocalDate localDate =
LocalDate.parse(currVal.toString());
writer.append(
"[" + localDate.getYear() + ", " +
localDate.getMonthValue() + ", " + localDate.getDayOfMonth() + "]");
} else if (currColType.equals("DATETIME")) {
- final LocalDateTime localDateTime =
LocalDateTime.parse(formatDateTimeValue(currVal),
- DateUtils.DEFAULT_DATETIME_FORMATER);
- writer.append("[" + localDateTime.getYear() + ", "
+ localDateTime.getMonthValue() + ", "
- + localDateTime.getDayOfMonth() + ", " +
localDateTime.getHour() + ", " + localDateTime.getMinute()
- + ", " + localDateTime.getSecond() + ", "
+ localDateTime.get(ChronoField.MILLI_OF_SECOND) + "]");
+ Calendar dateVal = Calendar.getInstance();
+ if (currVal instanceof Date) {
+ dateVal.setTime((Date) currVal);
+ } else if (currVal instanceof LocalDateTime) {
+ dateVal.setTime(
+ Date.from(((LocalDateTime)
currVal).atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
Review Comment:
MySQL 8 sends this exception in the `rs.getTimeStamp` method, so that was
the reason
<img width="1739" alt="Screen Shot 2022-07-24 at 19 42 10"
src="https://user-images.githubusercontent.com/44206706/180820330-a6580466-4ca4-4b15-8537-7da8b7313df0.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]