3

I know that when marking a field with @Transient , that field will be excluded during persistence . But in my case , I just want to ignore it in the find() function , not with the save() function.

For example:

myJpaRepository.save(myModel) will save the model as usual

myJpaRepository.find(id) will query the object but ignore the field that I want.

Since I am working with Hibernate spatial, one of my attribute is com.vividsolutions.jts.geom.Point , when perform something like myJpaRepository.find(id), it throws an exception like this :

org.springframework.dao.InvalidDataAccessApiUsageException: For input string: "PO"; nested exception is java.lang.NumberFormatException: For input string: "PO"

I know exactly this is the error from the Hibernate spatial point for PostgreSQL but I can not find an exact solution to solve it , my work around is to ignore that field when query but I don't know how to do it.

xtiger
  • 1,446
  • 2
  • 15
  • 33

0 Answers0