I am new to Spring Data JDBC, and I am struggling to create a simple Dto and get it persisted on the DB.
I am using Spring-Boot 2.1.1.RELEASE and and Oracle 12 Database.
I suffered the same problem, while the PR is being included in the next Spring Data JDBC release we can use the following workaround with Spring AOP, It's not "perfect" but enough for us until the underlying problem is solved:
@Around("execution(public * my-app-pacakage.repository.*.save(..))")
public Object aspectController(ProceedingJoinPoint jp) throws Throwable {
try {
return jp.proceed();
} catch (DbActionExecutionException e) {
if (e.getCause() instanceof DataRetrievalFailureException) {
return jp.getArgs()[0];
}
return e;
} catch(Throwable e) {
throw e;
}
}