Category "jpa"

Inconsistency between postgres and hibernate

Inconsistency between hibernate and postres. Consider we have table student having 2 columns id(Primary Key) and name. Perform the following concurrent query on

JPA cascading delete fails with custom delete method

I ran into an error with custom delete method in spring data jpa. Basically there's a bag which contains items, and when deleting the bag, all the items in it s

spring boot transactional integration for event management

We have recently put a REST Spring Boot MVC application into production. We are using JPA with Postgresql in order to achieve some nonfunctional requirements: w

spring boot transactional integration for event management

We have recently put a REST Spring Boot MVC application into production. We are using JPA with Postgresql in order to achieve some nonfunctional requirements: w

Is there a way to get the EntityManagerFactory on a project that uses Java Spring JPA but doesn't have a "persistence.xml" file?

I want to use the EMF to do queries constructed at runtime on a String. If there is a way I would appreciate it if someone could tell me how and give a small ex

JPA Hibernate OneToOne children enity always fetches parent entity

I am having a problem with a OneToOne relationship. Trying to load a children entity will always result in an additional query that loads its parent, even if I

How can I do a loop "do/while" to insert some data to Postgres Database?

I did this class to do the inserts but every time I need insert again, I need initialize the method main of this class again. Because it is in just one cycle. p

First time SQL query is taking More time from Spring Boot application

I have to fetch some records and then display in output. In my Spring Boot Application, I am using JPA Specification for creating Criteria and then calling repo

MariaDB CTE syntax for parameter list

I'm trying to replace an expensive where in ... query with a CTE. I've done this previously in other sql dialects, but can't get the syntax right for MariaDB/My

JPA/Hibernate: Named Query vs Native Query | Which one to use?

There is native query written by developer String sql = "Select * from TERP_META where id=" + id + " and type='KCH' ORDER BY ID ASC"; return entityManagerMaster

Is there a @LastAccessedTimestamp in JPA

I want to store the last read time in a Date column when ever someone tries to load or fetch(select query, findBy methods) a entity I had a look at @PostLoad as

Return DTOs in the controller

I have an Operation service that has a list function that returns a list of OperationDTO however when the controller calls this function the list returns null d

Using custom function call in CriteriaQuery multiselect cause a null pointer exception

I have a spring boot based application with hibernate-types included to properly map Postgres array to JPA entities. It works fine, but I run into an issue when

Using EntityGraph with SuperClasses and Embedded Attributes

I would like to use the EntityGraph Feature because of the known n+1 Problem. I have the following Entities structure: @Entity @Table(name = "customer") public

How to do a get request to SpringBoot java with an Array<Array<string>>?

I am doing a get request in angular with typescript and here it is: this.http.get("http://localhost:8080/data-management/data-users/getAllGeneralInfoCV/"+this.l

Spring Data JPA with hibernate annotations

We have a large code base using Hibernate and JPA with hand-made DAO Layer. Entites are mapped with JPA annotations (javax.persistence) and if needed, hibernate

JPA OneToMany / Parent - Child: can the child hold the parent ID alone?

I am a bit confused about bidirectional parent-child relationships. I have entities like so: Foo -> Parent -> List of Child Bar -> Child if I have on t

How to configure Spring Boot entity for GeoJSON?

I want to save a GeoJSON to database by using Spring Boot and JPA Example JSON object: { "type": "FeatureCollection", "features": [ { "type":

Truncating, Selecting data from multiple tables using joins and then inserting data into separate table in spring boot

I am using a spring boot application. I have multiple tables and using inner joins, I want to populate a temp table. Before populating, I have to truncate the t

How to remove foreign key without deleting the whole entity

I am new to Spring boot and I want to be able to delete the value of a forgein key if its entity is removed without deleting the whole entity linked to it; I ex