95,286 questions
1
vote
1
answer
35
views
How to extends PostgreSQL dialect to add support for some custom column type? No type mapping for org.hibernate.type.SqlTypes code: 1111 (OTHER)
I am writing integration tests and encountered with a problem. When I launch the app, everything works fine. However, when running the tests, I get an exception:
org.hibernate.MappingException: ...
0
votes
0
answers
6
views
@Nationalized probably not working with Hibernate Envers audit
I am using Spring Boot with Hibernate Envers to manage audit tables in a SQL Server database.
To optimize performance and handle non-Unicode strings properly, I updated my SQL Server connection string ...
0
votes
1
answer
22
views
Row was updated or deleted by another transaction Spring Boot
hey im new to spring boot and i am trying to create simple crud application using postgres and jpa when i trying running this project im getting this error shared below ,
its is something related to ...
0
votes
0
answers
19
views
How to Return a Connection to Hikari Pool After Database Retrieval
I am encountering an issue with HikariCP in my Spring Boot application. I keep seeing the warning message:
"Apparent connection leak detected."
It seems that a database connection remains ...
-4
votes
0
answers
20
views
Nested Java record in Hibernate criteria query
I cannot get hibernate citeria query working with nested Java Record because of: Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at "."
I defined the Java record as the ...
0
votes
2
answers
53
views
Configuring Java Spring boot for testing w/ H2 and running w/ MySQL
I am setting up a microservice using Java Spring Boot. The application runs in a Docker container and connects to a MySQL database on the local machine. For testing purposes, I want to avoid the ...
0
votes
2
answers
29
views
Query polymorphic jpa entity using spring data specifications?
Let's imagine following entities:
@Inheritance(JOINED)
@Entity
abstract class AbstractCompany {
@Id
private Long id;
private String name;
//...
}
@Entity
class Company extends ...
1
vote
0
answers
32
views
hibernate flush mode configuration
using spring 3.2.1,
I found that the default flushModeType = Auto causing me issues as im trying to work on the object before persist it.
I tried to set the flushMode to COMMIT, but whenever it ...
0
votes
0
answers
16
views
Use PhysicalNamingStrategy on underlying DataSources of AbstractRoutingDataSource
i am using spring-boot with hibernate's PhysicalNamingStrategy together with a AbstractRoutingDataSource from spring and MS SQL Server. The goal is to have a dynamic schema switching for different ...
0
votes
1
answer
36
views
Hibernate 5: OneToOne without @Id
I have class Products which has:
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "products_seq")
@SequenceGenerator(name = "products_seq", sequenceName = "...
0
votes
1
answer
25
views
An error is thrown because an entity field marked with the @Formula annotation is not contained in the resulting ResultSet
There is an entity that contains both regular and calculated fields via the @Formula annotation.
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "persons&...
0
votes
1
answer
20
views
ClassCastException for JPA query that tries to return the object queried in an inner SELECT statement
I have the following JPA query that attempts to find all the Children of a Parent object that fit under certain conditions, and then get only the first one of them under different partitions:
@...
3
votes
0
answers
39
views
Hibernate StaleObjectStateException After Upgrading to 6.6.3: Row was updated or deleted by another transaction or unsaved-value mapping was incorrect
Note: Before marking this a duplicate, please understand that I have gone through all the existing answers and issues but could not resolve the same.
I have two PostgreSQL tables: one for Product and ...
0
votes
0
answers
28
views
How to Create a Custom Hibernate SQL Dialect Compatible with Cloudera Impala (Hibernate 6.2.2.Final)
I am trying to create a custom Hibernate SQL dialect for Cloudera Impala. I'm using Hibernate 6.2.2.Final, and I need to ensure that the generated SQL for pagination uses the syntax LIMIT ... OFFSET .....
1
vote
1
answer
83
views
Why is my Scala project failing to find java.sql.Driver?
I have written a Scala+AKKA api using Scala 3. I then wanted to use Hibernate ORM to store data on the backend. I followed this guide: https://docs.jboss.org/hibernate/orm/6.6/introduction/html_single/...
1
vote
0
answers
26
views
Fix "org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.sqlExceptionHelper()" is null exception
After updating the Hibernate libraries. During startup, this exception is shown
java.lang.NullPointerException: Cannot invoke "org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(java.sql....
0
votes
0
answers
14
views
Hibernate Multitenancy: change tenant in session (discriminator column approach)
I am developing a springboot application which serves data for multiple tenants. To separate data between tenants I am using hibernates integrated multitenancy features for discriminator column-based ...
1
vote
2
answers
19
views
org.hibernate.MappingException: Unknown entity: org.example.Person
I am trying to save a record of Person class into mySql database using pure java and hibernate but I get this error. these are my classes. I appreciate any help why this error is raised.
With these ...
-1
votes
1
answer
27
views
Caused by: org.hibernate.type.SerializationException: could not deserialize Caused by: java.io.EOFException: null
I have a generic hibernate exception:
Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(...
0
votes
0
answers
31
views
JPQL issue on update query based on child entity value
The query is
@Transactional
@Modifying
@Query("UPDATE Record r " +
"SET r.blockedToConvert = true " +
"WHERE r.cliente.documento = :documento " +
&...
0
votes
0
answers
32
views
Hibernate 6 elementcollection fetching issue
I have following entities:
Template:
@Entity
@Data
@ToString
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
@Slf4j
public class Template implements ...
0
votes
0
answers
21
views
Discriminator missing in query generated by Hibernate
I have a class with discriminator:
@Entity
@Table(name = "INSTR_UNDERL")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "discriminator", ...
1
vote
0
answers
36
views
How to prevent the JVM timezone from being taken into account when loading "timestamp without time zone" into LocalDateTime
When loading "timestamp without time zone" into LocalDateTime, the JVM timezone is taken into account, which leads to shifted timestamps.
database column:
some_timestamp timestamp without ...
-1
votes
0
answers
183
views
How to save hibernate FetchType.Lazy feature with Clean Architecture?
According to the clean architecture:
Your Entity objects should be plain old objects that have no dependencies on frameworks or databases or other complications.
As we see in Uncle Bob's diagram, ...
3
votes
1
answer
33
views
HQL generate wrong cast
Having a cast like this:
SELECT
CAST(a * 100000000 as big_integer)
FROM
Amount
WHERE
id = :id
Generate this SQL:
prepareStatement(
"select cast(amount0_.\"a\"*100000000 ...
-6
votes
0
answers
61
views
Spring boot MVC project is not working due to status=404 Spring boot [closed]
I'm new to spring boot and built the MVC project but I'm facing the error:
Error:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat ...
-1
votes
0
answers
28
views
Hibernate Envers 5.6.15 mapping hbm ORM + envers annotation [closed]
In my project, I configured Hibernate 5.6.15.Final with HBM XML mapping for my classes and when to use Hibernate Envers on these classes by annotation.
On a class (Personne), I added @Audited(...
1
vote
2
answers
54
views
Java, spring, @Transactional
What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, ...
0
votes
1
answer
30
views
What is the most efficient way to update a large list of objects using Spring and Hibernate?
I’m starting a small project using Java Spring Boot and Hibernate. It’s a simple game app involving a deck of cards. A deck can contain anywhere from a few hundred to a thousand cards. Each card is a ...
0
votes
0
answers
23
views
Type declaration in Hibernate 6
So I was upgrading my old application to Hibernate 6, I was able to get most of the code sorted.
But this one column type is causing a problem.
@Column(name = "JOB_ID", columnDefinition = &...
0
votes
0
answers
39
views
Join fetch alias on Hibernate
I am migrating from Wildfly 10.0.0 to Wildfly 34.0.1, and then Hibernate is going from version 5.0.7 to 6.2.1.
I am having following error: "Error interpreting query [The JPA specification does ...
0
votes
1
answer
23
views
Persisting Data in spanner with JPA and Hibernate 6
I am working on integrating spanner with our existing application. I'm facing an error when trying to save/persist data into DemoClass entity in spanner using JPA and hibernate 6. The error I'm facing ...
0
votes
1
answer
53
views
Spring Boot: DELETE request returns 204 but doesn't delete the record from the database
I'm working on a Spring Boot application and trying to implement a DELETE endpoint to remove a record from the database. The API responds with 204 No Content, and my application logs indicate that the ...
0
votes
1
answer
46
views
Spring JPA - Changing the data type of an already established ID?
Long story short, I messed up and need to change an ID from a string to an autogenerated long within Spring and update any children with the newly generated number ID. I'm attempting to correct it ...
0
votes
1
answer
40
views
Error accessing column metadata in Hibernate 6
After migration from SpringBoot 2.7.18 to SpringBoot 3.4.0 and Hibernate 6 I have problem with automatic updating database structure.
When I set parameter
spring.jpa.hibernate.ddl-auto=update
I got ...
0
votes
1
answer
35
views
@Version causing update on Entity when modifying collection
I noticed that when I have a ManyToMany relationship and @Version field on an entity then when I try to add some other entitys that have relationship with this entity hibernate triggers an update on ...
0
votes
0
answers
9
views
How to deal with JPA Speficication when use @OneToMany relation?
The code is a simple example that helps explain the problem I have.
These are the entities I have:
@Entity
@Data
public class Parent {
@Id
@Column(nullable = false, updatable = false)
@...
-1
votes
1
answer
100
views
Problems with Hibernate startup logging after adding JPA with database in SpringBoot version 3.4.0
The specific issue log output is as follows:
2024-12-03T16:52:53.338+08:00 INFO 34784 --- [blog] [ restartedMain] org.hibernate.orm.connections.pooling : HHH10001005: Database info:
Database ...
0
votes
0
answers
7
views
Envers Library adding underscore in b/w letters of field/table names like r_e_v_i_n_f_o
I am using dropwizard with maven configuration
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
&...
-2
votes
0
answers
14
views
I'm getting class does not exists error in hibernate? [closed]
I have started learning hibernate im getting error ie I have created a class named Stds and marked it as entity and in the main class I created a object of that class and saved the object when I run ...
0
votes
0
answers
8
views
EntityManagerFactory to Plan SQL
I am using Intellij -->Tools -->Persistence and able to execute "Run Query in JPA Console" (Already DB is connected). And able to generate the output which has many joins.
Could anyone ...
0
votes
0
answers
20
views
Overriden DataSource Bean connection gets constantly closed
I have a setup where Spring-Boot, meaning Spring-Data in the end, manages all my database connections with the default settings. No problems there. For integration-tests I overrode the DataSource, ...
0
votes
1
answer
35
views
Making database work with a Dockerized Java Spring application
I would like to run my containerized Java Spring application which runs completely fine on my machine (of course, lol).
I have a problem with the JPA database connection.
What stumps me is that this ...
0
votes
1
answer
41
views
How to persist entities in @ManyToMany relationship with @EmbeddedId
I am using Spring Boot 3. I have 2 entities in @ManyToMany relationship: Meeting (table name is 'meeting') and Document (table name is 'document'), the relationship table is 'relation_document_meeting'...
0
votes
0
answers
19
views
Spring/Hibernage shares the persistence context from before the transaction with the transaction
In the following example, when the POST /foo/test1 endpoint is called, the entity will be saved to the database. However, calling POST /foo/test2 will not trigger any updates.
@RestController
@...
0
votes
0
answers
24
views
BeanCreationNotAllowedException while shutdown multithreading app
I'm a newbie with multithreading, but I've a task. I need to parse web sites in async mode.
I have next class and use ForkJoinPool:
@Service
@RequiredArgsConstructor
public class PageIndexingService {
...
1
vote
1
answer
31
views
How to prevent Hibernate 6.4 from storing @Column(columnDefinition = 'text') fields as Large Objects (LOBs) in PostgreSQL?
After updating from Hibernate 5.6 to 6.4, I noticed that fields annotated with @Column(columnDefinition = "text") are now stored as references to Large Objects in PostgreSQL. Instead of ...
0
votes
0
answers
54
views
Entity manger is coming null in spring boot using oracle jdbc
I am trying to invoke an oracle stored procedure with an input list.It failed with NullPointerException in OrderPlacementDaoImpl class. The exception occurs because the EntityManager is null.
Error ...
1
vote
0
answers
45
views
Dropwizard - new entities not commiting
We have a thread that queries external systems by clients. It receives a JSON array containing client information like id (which our system calls "customId"), name, phone, etc. The array is ...
0
votes
0
answers
17
views
Why hibernate is calling update for parent entity or for child entity itself after inserting a child entity in unidirectional relationships?
Inventory.java:
@Entity
@Table(name = "inventory")
public class Inventory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "inventory_id")
...