Category "hibernate"

Spring data: DeleteAll and Insert in same transaction

I am trying to achieve below native query logic using hibernate (Spring JPA). But save(Iterable) throws exception and rollback the entire transaction if one of

Is it a good or bad convention to update entity / row without calling save() in hibernate / spring-jpa?

Recently I found it not necessary to call repository.save() if within a @Transactional block. Hibernate / Spring-JPA will update row automatically when exiting

MappingException (Hibernate)

"Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister " I am not using any maven or such tools and manually add and reference

Hibernate / Spring Data - get executed sql queries count

I'm working on presentation in which I would like to show difference in number of executed sql queries between deleteByPost() method with and without custom que

Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException getting this Excdption

I am trying a simple program with hibernate but while retrieving data from db i am getting this error. But the insertion is working fine. I have provided the

Disabling auto commit in Spring boot not worked

I set two parameters to disable auto commit by False but save operation on entity without transaction was committed. spring.datasource.hikari.auto-commit=false

What is the point of @JoinColumn in hibernate?

I know that @JoinColumn is used for creating the foreign key column, but my question is little bit another. I noticed that if I have main entity with mapped by

Disable @CreationTimestamp in testing class

So I'm using Hibernate's annotations @CreationTimestamp and @UpdateTimestamp. It works fine, but I have this case when unit testing where I need to create objec

Nested ID class required to be named like relationship, even though not being a derived identifier?

There's chapter 10 in the book "Pro JPA 2 in Java EE 8", section called "Multiple Mapped Attributes", there the well-known department-project example using @IdC

Hibernate JPA error when inherited form other class

I am trying to have a abstract common class for all my entity. Here is my Entity class and abstract class:- @Entity @MappedSuperclass @Table(name="TBL_EMPLOYEE

Why would hibernate not close its session after select query?

When calling the following method 10 times there are 11 open sessions on the database: public void readHsql() { SessionFactory sessionFactory = getSessi

Spring Boot - Hibernate - Table does not exists

I have a 3rd party jar that holds all the entities and mapping. I am currently using this jar successfully in a classic Spring-MVC application, but now I am t

No qualifying bean of type 'javax.persistence.EntityManagerFactory' available whike upgrading SpringBoot from 2.1.18.RELEASE to 2.6.2

No qualifying bean of type 'javax.persistence.EntityManagerFactory' available whike upgrading SpringBoot from 2.1.18.RELEASE to 2.6.2 @ConditionalOnProperty("sp

Error executing DDL "drop table Player if exists" via JDBC Statement

Creating a spring mvc project with database using java configuration . The application gives error for tables operation like create, drop, alter operation for

Why am i getting timeout exception after 4 requests to database?

I am building quarkus websocket test application with reactive panache connection to postgres. Code: @Slf4j @RequiredArgsConstructor @ServerEndpoint(value = "/a

select query inside loop - Database connections in JPA

In my Spring MVC application, I have @Transactional annotated method inside which I make call(select query) to DAO layer inside for loop. If my input list size

Spring Data JPA / Hibernate "Unable to locate Attribute with the given name"

We have a problem with a Spring Web Application and Hibernate. It is written in Kotlin. We have an abstract Entity @Inheritance(strategy = InheritanceType.JOI

Northwind - creating orders (MySQL + Spring boot)

I have DB with schema like below: I would like to create an Order. I created DAO of Order with all columns like below and added there relations like this: O

No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor

When i try to navigate to an endpoint i get the following error Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyIntercep

How to get only those objects whose subarrays in the arrays match the requested one with SQL and Hibernate?

I have Project objects that contain arrays of Tags (for example, Backend, Frontend, Sales, Marketing). The user sets the desired parameters, such as Backend and