Skip to content
Advertisement

Tag: spring-boot

Populate DTO using query with JOIN

I have this main Product table: Additional table for storing categories that should be returned as List: Additional table for storing Payment Methods that should be returned as List: I want to return a result like this: I tried this: What is the proper way to populate this DTO? Answer If, as indicated in your comments, you need query your

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

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

Advertisement