Questions tagged [hibernate]

Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.

Filter by
Sorted by
Tagged with
0 votes
1 answer
14 views

flyway - No migrations found. Are your locations set up correctly?

$tree: . ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main │   ├── java │   │   └── com │   │   └── example │   │   └── j3 │   │   ├── ...
milanHrabos's user avatar
  • 2,048
0 votes
2 answers
35 views

Error creating bean with name 'platformTransactionManagerCustomizers'

I am learning how to use Spring Boot. I am trying to connect my application with my database, but I am not entirely sure why I am getting this error and how to fix it. I can't find anything online. ...
tobieche's user avatar
0 votes
1 answer
24 views

Why am I receiving NonUniqueDiscoveredSqlAliasException?

The database have book and book versions. I need to get only books which: The version it is the latest version or v.generated_from another is null (it means that isn't a stable version) Get by a ...
Daniela Morais's user avatar
0 votes
0 answers
25 views

Hibernate batch insert not working as expected

I am using hibernate batch insert in for DB2, but not get it worked properly. This is my table definition: CREATE TABLE MY_TABLE (IDENTIFIER VARCHAR(64) NOT NULL, MESSAGE VARCHAR(10), CREATION_DATE ...
sensen ol's user avatar
0 votes
0 answers
16 views

Persist error: How to resolve 'Detached entity passed to persist' issue?

There are 2 different versions of a code written. The second of these versions (code2) gives the Detached entity passed to persist error. How can I get over this? Error Message -> detached entity ...
Muhammed Hakan ÇELİK's user avatar
0 votes
1 answer
19 views

Could not commit JPA transaction while working with post request

I'm attempting to send a post request with an image attachment and employee details in json format. For ImageData and Employee, I have distinct tables. I am able to store image data with my code, but ...
Ch Vamsi's user avatar
1 vote
0 answers
20 views

Why does Spring Data Jpa's composite primary key query findById generate an in query?

spring boot version 3.2.0 hibernate version 6.3.1.Final jpa entity info @Data @IdClass(value = SeasonEntityPrimary.class) @Entity @Table(name = "seasion") public class SeasonEntity ...
RainySeasonYuyuko's user avatar
0 votes
1 answer
15 views

Bootstrapping hibernate drop tables when using xml, but is ok when using property file

I am running different testcases for bootstrapping hibernate SessionFactory in different scenarios. When I use StandardServiceRegistryBuilder like shown here, it runs ok when using properties file aka ...
armagedescu's user avatar
  • 1,818
0 votes
0 answers
44 views

Before saving a new record, Hibernate deletes all the records of this collection in the database, and then overwrites the new one

I'm learning the Spring framework and doing the server side of the project. I have the following problem: I have User and Film entities. They have a many-to-many relationship, that is, a User can ...
Fatia's user avatar
  • 1
0 votes
0 answers
10 views

Postgres JsonBinaryType is not working with Upgrade to SpringBoot Version 3.1.5

I have a SpringBoot project which persists data to a Postgres JsonB Column. So I am using the @TypeDef annotation in entity class, but after upgrading to SpringBoot Version 3.1.5 this annotation is no ...
vishal kumar's user avatar
0 votes
1 answer
21 views

Hazelcast + Hibernate query slowdown when using second level cache

we are currently using in Hibernate 6.3.1 as a second level cache Hazelcast 5.3.6. we are experiencing a significant slow down in performance when a second node joins the cluster. currently Hazelcast ...
BigMichi1's user avatar
  • 307
0 votes
0 answers
36 views

How does deleteAllBy... method work in Spring Data JPA? Why does it it make more DELETE queries then needed?

In my project I was using this method for my entity repository void deleteAllByCompanyBranch_Id(Long companyBranchId); And the result was a little bit weird, Hibernate generated DELETE query for each ...
denstran's user avatar
0 votes
0 answers
29 views

Spring Data JPA + Hibernate Skip Locked rows - Oracle SQL

I am trying to do a job on multiple threads that selects and updates records in an Oracle database. Do to this, I want to select each row individually, do some work and then mark it as done (by ...
ROBLCSnail's user avatar
1 vote
1 answer
17 views

JPA query for selecting entities based on contains clause doesn't work

Country.java String state; String city; We would like to query all entries which contains a certain keyword (select * from countries where state=<state> and city like %Ch%) Page<List<...
user352290's user avatar
0 votes
1 answer
34 views

List<type> applications is not listed in postgres. Java, spring boot, jpa, hibernate [closed]

I'm not familiar with using hibernate as much as I should be. I am able to Create a Job Post, I am also able to Send in an application for that. However, there seems to not be a connection between the ...
kratos's user avatar
  • 1
0 votes
0 answers
11 views

Is it possible to only log the query and parameters, omit the result from the query in hibernate log4j

[DEBUG] 2023-11-24 18:58:06.198 [http-nio-8080-exec-9] SQL - select distinct employee0_.ID as col_0_0_ from EMPLOYEE where employee0_.ID=? [TRACE] 2023-11-24 18:58:06.198 [http-nio-8080-exec-9] ...
Dark Knight's user avatar
0 votes
0 answers
23 views

Spring-boot 3.1.0+ / Hibernate 6.2+ - Unable to generate the COUNT query from JPQL

My project is currently working properly in spring-boot version 3.0.6 with Hibernate 6.1.7. Since the release of spring-boot 3.1, which upgrade Hibernate to 6.2.2 (issue still present with spring-boot ...
Arthur Saint-Genis's user avatar
0 votes
1 answer
32 views

Exception when i am trying to execute delete @Query

I am trying to execute this @Query in my EmployeeRepository class @Modifying @Query(value = "DELETE FROM Employee e WHERE e.department.companyBranch.id = :companyBranchId") void ...
denstran's user avatar
0 votes
0 answers
20 views

Why is it not cascading? I am tring to insert data into two tables using cascading but values is inserted for only on owning table

I am tring to insert data into two tables but values is inserted for only on owning table... Following are my codes: Question Entity Class: @Entity @Table(name="ques") public class Question {...
mansubba2022's user avatar
0 votes
1 answer
55 views

Spring Data JPA: How to get parent entity with childentity Ids only instead of whole child entity

I have a Spring Data JPA setup with entities Player and Rating. In my use case, I want to retrieve all ratings for a specific user by their ID. However, I don't want to fetch the complete User entity ...
Feldwebel's user avatar
0 votes
1 answer
34 views

Java Garbage Collector - CMS vs G1

I have a question about a garbage collector. I have set 24GB for my Xms and Xmx, but the problem I'm facing is that I see that the full heap size is never used - the garbage collector seems to run ...
sunny's user avatar
  • 95
1 vote
0 answers
14 views

Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-212]

I was Debugging my Java Code, but now I'm getting this error. Earlier also it happened to me and I used to delete the process but Now I'm not able to find the process id and also All the connections ...
Rahul Kumar's user avatar
0 votes
0 answers
29 views

Hibernate query order by using alias

When I want to create query with sorting via JpaRepository or CriteriaQuery, I get hibernate translated query like this: select table0_.sys_crt_dttm as sys_crt_4_44_ from `table` ...
dtadescu's user avatar
0 votes
0 answers
30 views

What is the replacement of Ingres10Dialect in Hibernate 6?

When upgrade to hibernate 6, the Ingres10Dialect class is not found. I have some legacy application, which worked in Hibernate 5.4.20. Is there any replacement for that in hibernate 6? FQN: org....
Rick Gong's user avatar
0 votes
0 answers
25 views

Spring transactional does not respect the order of execution

I have been trying to understand/solve why custom queries executed at the end of the transaction block. @Transactional public void removeOrderFromPackages(OrderEntity entity, User currentUser) { ...
Abdullah Tellioglu's user avatar
0 votes
1 answer
29 views

How to add some logic before removing entity without @PreRemove?

I found a problem in my project. A have those three entities: CompanyBranch, Department, Employee. Relationship between CompanyBranch and Departmen is One-To-Many, same with Department and Employee. ...
denstran's user avatar
1 vote
3 answers
113 views

MySQL - nested inner joins make the query vey slow - solutions?

I have a query: select count(*) from transaction_entry inner join inventory_item on inventory_item_id = inventory_item.id inner join transaction on transaction_id = transaction.id inner join product ...
sunny's user avatar
  • 95
0 votes
1 answer
68 views

JPA. Specification, Implementation or both?

I study the JPA. The book uses classes, interfaces and annotations from javax.persistence package like @Entity,@Table,EntityManager etc to make a real and functional ORM application. When I searched ...
nonlinear's user avatar
0 votes
0 answers
15 views

How can I add a minimum value constraint using Hibernate schema tool?

I am currently adding data validation at all levels of my Spring MVC application. As I understand it, there is two levels of validation that can be applied to an @Entity annotated JPA entity with ...
Bazoya's user avatar
  • 23
0 votes
1 answer
35 views

Spring Boot JPA OneToMany Update not working

My Spring Boot app uses JPA, Hibernate and a MySQL db. I want to save users with working-times. User.java @Entity(name = "User") @Table(name = "user") @DynamicUpdate public class ...
Martin Pfeffer's user avatar
1 vote
0 answers
29 views

Can't complile when extendig abstract class

I've got the next abstractions: abstract class GraphUnit(var newsSources:Set<NewsSource>): NewsParent { //... fun getImportantNewsCompleted(): List<Informacion> { //Do ...
Lucas Tomic's user avatar
0 votes
0 answers
9 views

Spring data jpa, delete by collection of projections

I have a class @Entity @Table public class Something { private String param1; private String param2; private String param3; private String param4; private String param5; } is it possible, using ...
Ivan Karotki's user avatar
-2 votes
0 answers
31 views

jakarta.persistence.RollbackException: Error while committing the transaction

So I get such error - org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction at org.springframework.orm.jpa.JpaTransactionManager.doCommit(...
Charismatic's user avatar
0 votes
0 answers
21 views

Hibernate about non-primary-key Association

i tried to use hibernate anntation about @OneToMany to handle two entities association, when i use primary-key column mapped with anntation @FechMode.SubSelect can filter records (console will print ...
big MT's user avatar
  • 1
0 votes
1 answer
34 views

JPA auto query generation using method name not working as expected

In the below findAll and findByUserNameAndPlantId is working where as findAllByPlantId and findAllByAccessPlantsSet_AccessPlantKey_Plant_PlantIdIn is not working. Both generating wrong query(compared ...
Sreejesh's user avatar
1 vote
2 answers
93 views

Validation failed for query for method upgrading from Spring Boot 3.1.5 to 3.2.0

I upgraded from Spring Boot (Data) 3.1.5 to 3.2.0. Several of my queries in the Repositories throw exceptions now on application start in the validation phase: Caused by: Cannot compare left ...
Thirdman's user avatar
  • 658
0 votes
0 answers
18 views

Hibernate alias issue

I want to pass location.locationId in my alias but the alias picks up the bases entity. any clue how to do it? Criteria cri= session.createCriteria(User.class) .setFetchMode("...
huudusd's user avatar
0 votes
0 answers
24 views

Store JPA auditing timestamp in milliseconds

Instead of storing the timestamp in Date/Timestamp format, I want to store it as milliseconds i.e. System.currentMillis(); Also, what is the recommended format while dealing with timestamps/dates with ...
spyder's user avatar
  • 61
0 votes
1 answer
12 views

How can I make child entities always join?

I have the following entity. class Parent { @OneToMany(mappedBy = ..., fetch = ...) private List<Child> children; } Is there any hibernate specific annotation that telling to always ...
Jin Kwon's user avatar
  • 20.7k
0 votes
0 answers
28 views

Java 17 Recursive @EntityListeners - Spring Data Jpa

I have two entities, Parent and Child. The relationship is One parent can have many children and one child can have one parent. Here are my classes: @Data @Entity @Table(name = "parent") @...
Vitor Nilson's user avatar
0 votes
0 answers
15 views

Size of @Lob annotation column to accept multiple large files of around 100 mb

I am trying to upload multiple files in MySQL database. I am using Multipart to achieve it. While defining the Model 'FileDB', I came across an issue with size of Column that stores the Attached ...
Ashika Jinturkar's user avatar
0 votes
0 answers
16 views

CriteriaQuery Joining entities in Hibernate single table inheritance

I am facing an issue while trying to perform a join involving entities in a Hibernate Single Table Inheritance scenario. I have two entities: VehicleEntity (base class) and CarriageEntity (subclass ...
Marc Serret i Garcia's user avatar
0 votes
0 answers
22 views

Db2 Performance issue in Azure. Hibernate with DB2

My application is having big query. when I am executing the query it is fast in db2 editor(squirrel ). But through application, it is very slow. it is taking 3 mins to execute that query. select * ...
Ramkumar's user avatar
  • 152
0 votes
2 answers
33 views

JPA query with sorting by ElementCollection gives UnsupportedOperationException

When there an entity which has an ElementCollection field of a simple type, and on trying to have query using sorting of that field, there is an UnsupportedOperationException public class SomeParent { ...
Ahmed Ashour's user avatar
  • 5,202
0 votes
0 answers
6 views

Hibernate: NamedQuery is not finding previously created entities

I am working with Java 1.8, Hibernate 5.6.15.Final, Spring 5.3.27 and Spring.data Neumann-SR9 I have created several entities using Hibernate/JPA using getEntityManager().persist(entity), these ...
Edmund's user avatar
  • 71
0 votes
0 answers
41 views

ConstraintValidator after migrating from Spring boot 2.7.15 -> 3.1.X

I've been tasked to migrate to Spring Boot 3, so I'm taking the oportunity to simple update to the latest version. As I expected there are some migration pains that I have been dealing with. At the ...
Stieg's user avatar
  • 136
0 votes
0 answers
22 views

OptimisticLockException on entityManager.flush()

ERROR Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) javax.persistence.OptimisticLockException: Row was updated or deleted by another transaction (or ...
Ksushant881's user avatar
0 votes
1 answer
29 views

Spring image upload with @onetoonemapping

When I upload an image I get an image_id and when I use that id to upload the product the upload is successful but the image_id field in the product table is empty. I have provided the code below and ...
Abrar's user avatar
  • 38
0 votes
0 answers
21 views

Quarkus Panache multiple dependent parameters

I have simple, versioned entities with some other, irrelevant fields and would like to select a list of them with dependent parameters. While the entity is not a PanacheEntity, my corresponding repo ...
Markus's user avatar
  • 111
0 votes
0 answers
7 views

Hibernate unproxy object with lazy relations while debugging

I'm debugging a hibernate application, while debugging I want to check the entities. Hibernate.unproxy(entity) just works for plain types and not for relations within the entity (FetchType is lazy). ...
ch1ll's user avatar
  • 441

1
2 3 4 5
1893