keyHolder.getKey() return null


Let's correct the following exception found in Spring in action. This exception is a result of:

- The post request in the method processDesing which call the method save in the interface repositorydesignRepo.

- In the method saveTacoInfo of the class JdbcTacoRepository,  a KeyHolder is created to get the associated Id of the newly created object (Taco).

- But the value of  keyHolder.getKey() is null


java.lang.NullPointerException at at at$$FastClassBySpringCGLIB$$59d8a28e.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke( 


By default, returnGeneratedKeys = false. To unable the return of generatedKeys set it to true

Add a comment