MAX(CONVERT(column, TIME(3))) The value returned from the mysql client is different from the value returned by the JPA native query. The first one is returning (in my sample data) the correct value 47:40:00.000, but the JPA native query returns 23:40:00 and don't know why since it has the native query flag.
The problem is because of the conversion from local time format (equivalent to sleep time) to string. I solved the problem of converting to string on MySQL.