Skip to content
Advertisement

Tag: jpa

JPA batch_size property does not work for native query

I’m trying to make a bulk insert with a native query. I’ve added batch_size property to the application.properties file But in the logs, I see that every insert processed separately. Is it possible to apply batching to native query? Answer If the entities use GenerationType.IDENTITY identifier generator, hibernate will silently disable batch inserts/updates. Please find the following link for the

How to use JPA to save datetime of SQL to fix: “Conversion failed when converting date and/or time from character string.”

I got a very frustrated problem.. I cannot use the JPA save function to store correct datetime object of SQL, I got the following error: There is my code: In Controller: In Entity: Many thanks!! Answer I recomend you to use LocalDateTime of modern java.time. JPA automatically convert LocalDateTime into database datetime. To get current datetime use LocalDateTime.now(). You can

SQL select data based on a one to many relation

I struggle a little with the following database entity relations: I would like to create a query where I get all events for a user that is either the owner (item-user_id) or a participant (participant-user_id) I got back to native queries, cause they are more easy to try out. But the one to many relation between the registration and the

One to One Mapping Spring boot

Hello everyone in advance I have a problem with my one to one connection when I try to log in to the “user” I get this error what i need is a one to one connection that does not have to be persistent that means a user can have a player but does not have to have it and the

How to compare timestamp in HIBERNATE query?

I have one value of timestamp that I retrieve from the database and then compare it with the current timestamp. I actually want to retrieve data of people who have been logged in for the last two hours. Unfortunately, I am facing this error. please help me, guys. I shall be thankful to you. I have stuck in this code.

Database performance: Split table or keep together

For our project we want to save employees and customer in one or two database tables. The customers have the same columns as the employees (e.g. name, address, language, email,…). The employees on the other side do have additional columns like SocialSecurity Number, bankaccount,… Since the two have many similar columns it might be senseful to merge them into a

Advertisement