How to change the Hibernate CharacterTypeDescriptor to handle empty column values
问题 Our problem is that we can't get data (which includes empty strings with length 0) from a legacy database due to a StringIndexOutOfBoundsExceptiion originating from Hibernate's CharacterTypeDescriptor . We would like to change Hibernate's behavior to properly resolve empty strings. Example data: 1, 'Berlin', 17277, '', 'aUser' 2, 'London', 17277, '', 'anotherUser' We use hibernate with javax.persistence.Query . String sql = "SELECT * FROM table"; Query query = entityManager.createNativeQuery