I want to call procedure in spring jpa with null parameter but throw IllegalArgumentException or NegativeArraySizeException

Viewed 58
service.saveUser("name", "family", null); 
@Query(value = "call INSERT_USER(:FIRST_NAME, :LAST_NAME, :AGE)", nativeQuery = true)
void saveUser(
        @Param("FIRST_NAME") String firstName,
        @Param("LAST_NAME") String lastName,
        @Param("AGE") Integer age
);

record insert in db but method throw NegativeArraySizeException

@Procedure("INSERT_USER")
void saveUser(
       @Param("FIRST_NAME") String firstName,
       @Param("LAST_NAME") String lastName,
       @Param("AGE") Integer age
);

if fill all item insert without exception but if age equal null record not insert in db and throw IllegalArgumentException Bind value [org.hibernate.jpa.TypedParameterValue@347447ab] was not of specified type [class java.lang.Intege....

0 Answers
Related