Skip to content
Advertisement

Tag: spring-data-jpa

Spring Data Insert Data when entry not yet exists

SCENARIO: I have a MySQL Database where I have one Table with a Mapping of a user and a product. My Application offers an api so I have to be aware that the mapping will not be done multiple times. Therefor I want to check if the two ids( of the user and the product) are already mapped. PROBLEM: I

How to log failed sql in hibernate?

I’m building a SpringBoot application with spring-data-jpa. I know how to log all sqls from this question. How to print a query string with parameter values when using Hibernate But what if I only want to log failed sqls? Answer There are two options: Configure sql logging with parameter values. Disable jdbc batching and enable flushing through hibernate means. Add

Hibernate not allowing to increment by 5 in sequence

I have following db sequence Java However with Hibernate I am getting following error which says hibernate is expecting increment by 50. Why is so? Edit1 Added java code. Answer The error message is quite clear. You have enabled (or not disabled) schema validation, so when the application starts Hibernate is comparing the database with what it expects from annotations

Advertisement