Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
1 vote
1 answer
58 views

I am facing an issue for mapping string value to DB column

I am facing an issue while saving or fetching string fields into postgres database in JDK21 and Spring boot 3.3.2 and hibernate 6.6.1.Final version , where its always trying to map empty value to ...
shanta's user avatar
  • 1
0 votes
0 answers
79 views

How do I delete an embedded ElementCollection with the parent entity in Hibernate?

I have an entity holding a collection of embeddable objects: @Entity(name = "LogbookEntry") public class LogbookEntryView { @ElementCollection(fetch = FetchType.EAGER) @...
Double M's user avatar
  • 1,513
0 votes
1 answer
30 views

How to increment version when updating a ManyToMany collection with @JoinTable in Hibernate?

I’m using Hibernate v6.6 with optimistic locking, and all of my entities have a @Version field. My Person entity has a ManyToMany association to Concept entity: @Entity class Person { @Id @...
Apoorva Manjunath's user avatar
0 votes
0 answers
21 views

Modeling Hibernate entities for localization

I'm trying to create java resources using Hibernate framework to represent some Business entity like Product or Address along with Localization. I want to use one localization table for all entities ...
Roman N's user avatar
2 votes
2 answers
224 views

InvalidDataAccessApiUsageException: org.hibernate.TransientObjectException: persistent instance references an unsaved transient instance

I have the following Hibernate tables in Spring Boot 3.5.0 application: import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.NotFound; import org.hibernate....
Peter Penzov's user avatar
  • 1,064
0 votes
1 answer
58 views

expecting IdClass mapping

I am upgrading an ancient Spring 3 app to Spring 6. I have found a number of issues with the same message, but they are mostly actually using annotations. The one that isn't: java/hibernate Exception: ...
Thom's user avatar
  • 15.3k
0 votes
1 answer
88 views

Hibernate: OneToMany and OneToOne for two classes in SINGLE_TABLE_STRATEGY

I have a parent class: Person and two child classes: Hunter and Policeman. A Hunter can have several Dog, and a Policeman can only have one Dog. It's a unidirectional relationship, the Dog entity only ...
parsecer's user avatar
  • 5,239
1 vote
1 answer
111 views

how do I properly annotate hibernate persist EntityA which contains a Map<String, List<EntityB>> and EntityB contains a List<EntityB>?

I have the following classes: @Entity @Getter public class EntityA { @Id private long id; Map<String, List<EntityB>> map; } @Entity @Getter public class EntityB { @Id ...
AixNPanes's user avatar
  • 1,288
0 votes
0 answers
31 views

Hibernate @Any discriminator not found handling

With Hibernate 6.2, how to do not-found handling for a entity with @Any association? My entity mapping is: @Any @AnyDiscriminator(DiscriminatorType.STRING) @AnyKeyJavaClass(UUID.class) ...
Apoorva Manjunath's user avatar
1 vote
1 answer
47 views

Hibernate Configuration for File Config via code

I'm using Hibernate 5 and I need to configure them using code. I have established the Connection. But the Entity classes are not mapped. So How can I do this. Due to this I can't able to insert data ...
Dood's user avatar
  • 15
1 vote
1 answer
122 views

DuplicateMappingException after extending @Entity with @Inheritance

I have a table my_entity that is referenced by multiple @Entity annotated classes like so: @Immutable @Entity @Table(name = "my_entity") public class EntityA { ... } @Entity @Table(name = &...
flauschtrud's user avatar
0 votes
0 answers
39 views

How to fill cache with new values when query cache expires : Ehcache 3 and hibernate 5

I have a query cache called RatesCache to store the result of my database call of RateEntities. I set the query cache like this for test purpose and every 30s ttl, when it expires it make a new call ...
yuyusqqsd's user avatar
-1 votes
2 answers
95 views

problem with maven generation : HyperJaxb fails on Java JPA float array mapping

i have 2D double array attribute but as JPA doesn't work with array i have a @XmlJavaTypeAdapter(DoubleArrayAdapter.class) to store my array in a string for postgresql... I am working with JDK 21 and ...
ghelle's user avatar
  • 1
0 votes
1 answer
31 views

How to configure One To Mane mapping between entities both have composited key

My entity MrsConHist has One to many map to MrsConHistCar, MrsConHist and MrsConHistCar both have composited key class. when MrsConHist.getMrsConHistCar(...), I got error: [ORA-00942: table or view ...
Daxin's user avatar
  • 1
0 votes
1 answer
32 views

Is it possible to map One-to-one association if primary key is generated and I'd like to have cascading specified?

I have two tables in one-to-one association, mapped by their primary keys. PKs are UUID. I'd like to map these in hibernate, so that I will persist parent entity and referenced child entity will get ...
Martin Mucha's user avatar
  • 3,267
0 votes
1 answer
100 views

Hibernate-ORM 6 NonUniqueDiscoveredSqlAliasException on native recursive HQL query

I am upgrading an spring boot app (spring-boot-starter-parent) from 2.6.1 to 3.4.1. part of that upgrade is related to the upgrade of hibernate 5 to 6 and specifically hibernate core 6.6.4.Final with ...
Tito's user avatar
  • 2,310
0 votes
0 answers
46 views

PostgreSQLEnumJdbcType in Hibernate drop column

I have a class with enum: import jakarta.persistence.*; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.JdbcType; import org.hibernate.dialect.PostgreSQLEnumJdbcType; ...
Denys's user avatar
  • 1
0 votes
0 answers
45 views

Hibernate is getting confused between primary key and foreign keys, giving mapping exception

I have following mappings @Entity @Table( name = "SECURITY_ZONES" ) public class SecurityZones implements Serializable { @Id @Column( name = "secZONE_ID", precision = 4 ) ...
Sanat's user avatar
  • 1
0 votes
1 answer
173 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 = &...
hell_storm2004's user avatar
0 votes
0 answers
24 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") ...
Shri's user avatar
  • 191
0 votes
0 answers
36 views

when using hibernate getting error Could not determine recommended JdbcType for Java type 'com.example.JpaRevision.repository.courseRepository'

when using jpa specification along with hibernate below error is occuring i have created one to one relation between course and courseMaterial and started the application but it's not working due to ...
Dropda Mahangare's user avatar
2 votes
1 answer
716 views

Hibernate 6.6 fails if there is a composite generic @Id partially in a @MappedSuperclass

Update 2025/05/12 Having tried to create a Hibernate Test Case, I found out that my problem isn't about generic identifiers. It's about composite keys whose fields are distributed between classes. The ...
Yury Shafran's user avatar
1 vote
1 answer
55 views

Why am I able to use ReverseStringComparator.class as the value of the @SortedComparator annotation when it is not a primitive or a String? [duplicate]

@Entity @Table(name = "student") public class Student { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; // other fields @ElementCollection @...
Sudhanva BS's user avatar
1 vote
1 answer
195 views

Bad value for type long" Error in Hibernate when Mapping ManyToMany relationship

I’m encountering an issue while working on a Spring Boot application that uses Hibernate for ORM. Could not extract column [3] from JDBC ResultSet [Bad value for type long : Allows creating new ...
Martin Dúbravka's user avatar
0 votes
2 answers
107 views

Hibernate OneToOne association, owning side not saving foreing key

I'm learning Hibernate (v. 6.6.1 final) and have a problem with a OneToOne relation Customer Entity @Entity @Table(name = "customer") public class Customer { @Id @Column(name = &...
CodeCrafter's user avatar
0 votes
1 answer
116 views

Why Hibernate not saving new child object in OneToMany relation

I'm learning Hibernate ( v. 6.6.1 final) and have a problem I have two entity classes Person @Entity @Table(name = "person") public class Person { @Id @Column(name = "id")...
CodeCrafter's user avatar
0 votes
1 answer
33 views

'com.provider.fatoria.model.ConfigPergunta' (use '@Column(insertable=false, updatable=false)' when mapping multiple properties to the same column)

I have a problem because my table has a self relationship. I have to be able to insert and change the column, but it always gives this error: Column 'idTipoDoctoEntrada' is duplicated in mapping for ...
Felipe Veiga's user avatar
0 votes
1 answer
112 views

Mapping from Domain Object to JPA Entity: How to properly fetch associated entity?

I am following DDD in my application and I want to separate my persistence layer from domain layer. I have to map the Domain objects to JPA entities for persistence. I have one Domain aggregate named ...
genuinebookworm's user avatar
0 votes
1 answer
105 views

Use EntityGraph for query with optional ManyToOne relationship

I've got a Hibernate entity with an optional relationship to another entity: @NamedEntityGraph( name = "expense-for-frontend", attributeNodes = { @NamedAttributeNode("...
Kevin's user avatar
  • 1,871
0 votes
1 answer
37 views

How to map a PostgreSQL array with Hibernate to custom objects?

Has anyone mapped a numeric array in PostgreSQL to a List of CustomObject in Java via Hibernate? SQL CREATE TABLE sal_emp (name varchar, work_station bigint[]); INSERT INTO sal_emp VALUES ('one', '{1,...
Gautham Churchill's user avatar
2 votes
1 answer
81 views

Unable to override global version in Grails 6

In the process of upgrading from Grails 3 to Grails 6, I am getting different behavior in bootRun vs. war deployments. This setting in conf/application.groovy is set to disable the version (optimistic ...
Ben W.'s user avatar
  • 401
0 votes
1 answer
739 views

Getting Cannot invoke "org.hibernate.metamodel.mapping.ModelPart.getNavigableRole()" because "subPart" is null after migrating to Spring Boot 3.3.3

I have a task to migrate to Spring Boot 3.x (from Spring Boot 2.6.5) and I chose OpenRewrite tool to help me with this task. After all the migration changes were done, running the application locally ...
user3762913's user avatar
0 votes
1 answer
130 views

Migrating from spring boot 3.0 to 3.2 is causing issues with inserting objects into Oracle database

Recently, we migrated from Spring Boot 3.0 to 3.2 and lost our ability to insert an object into the Oracle database. The following is the object in contention: @Entity @Table(schema="S1", ...
user1540821's user avatar
4 votes
1 answer
222 views

How to dynamically add, modify and remove Class Mappings and Entities in existing SessionFactory without rebuilding it?

I’m facing significant challenges with NHibernate in my .NET application, particularly around dynamically creating tables and altering schemas at runtime. My application needs to create millions of ...
Ember Freak's user avatar
  • 12.9k
0 votes
1 answer
51 views

Hibernate @ManyToMany Mapping Issue: Unknown Column in Join Table On Clause (hibernate ignoring @JoinTable and @JoinColumn annotations)

I'm encountering an issue with a @ManyToMany mapping in my Spring Boot application using Hibernate. The problem arises when Hibernate tries to execute a query involving the join table for a Set<...
Malumbo's user avatar
1 vote
0 answers
77 views

How to implement a double relation between entities with hibernate 6.5

I have a database on which 2 tables have a double relationship : Database graph The Spot may be the parent of several SpotConditions, so there is a basic OneToMany relationship. But in addition, each ...
Colin Lefebvre's user avatar
0 votes
0 answers
30 views

Exception in thread "main" org.hibernate.MappingException: Unknown entity....Hibernate-5

pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ...
Vikram Markali's user avatar
0 votes
1 answer
80 views

Joining Entities by a Range - Hibernate

I have a question regarding Hibernate that's been bothering me for some time. Consider I have two entities: @Entity public class Statement { @Id @Column private int id; @Column ...
Krusty the Clown's user avatar
0 votes
0 answers
273 views

Joda-time type mapping in Hibernate ORM 6

I'm new to Java and I am trying to migrate from Hibernate 5 to 6. My application uses joda-time for the timestamp data type. It is using both annotation and hibernate mapping files. Following is a ...
tieuquynd's user avatar
0 votes
0 answers
32 views

Calling stored procedure with Hibernate which multiple type of outputs

I have a stored procedure from my DBA team. Here is the stored procedure, and temp table created. All I want to know here, how to map the temp table to the output value while calling the procedure in ...
Just a coder's user avatar
0 votes
0 answers
138 views

SoftDelete issue

I am encountering an issue with the @SoftDelete annotation in my entity class. It forces eager loading, which is causing performance issues. Consider the following class: @Entity @Data @SoftDelete ...
user1470509's user avatar
1 vote
1 answer
54 views

Hibernate try to set my id field to the current object, what am I doing wrong?

I searched for a long time but I cannot understand what I am doing wrong here. I'm using spring boot with starter-data-jpa. Versions: Hibernate: 6.3.1.Final HikariCP: 5.1.0 springboot dependency ...
Azn9's user avatar
  • 99
0 votes
0 answers
40 views

Multiple ManyToOne relationship raised not mapped to a single property error

I have 3 entity class Parameter entity class with multiple ManytoOne relationship. Entity class below @Entity @Table(name = "t_gcg_parameter") public class GcgParameter extends Common ...
kukuh utama's user avatar
0 votes
1 answer
135 views

Using @SqlResultSetMapping to map to list

Person ID Name 1 Luis 2 Frank Address Person-ID Address City 1 Samantha Road x 1 Franklin y In my Hibernate native query I want to map the result of one person to a set of addresses, such like the ...
sensen ol's user avatar
0 votes
0 answers
46 views

Hibernate not generating additional queries while fetching associated entities in eclipse console

Below is my Owning side Entity - @Entity @Table(name = "T_PERSON") @Inheritance(strategy = InheritanceType.JOINED) public class Person { private Long id; private String firstName; private ...
Debaprasad Jana's user avatar
-1 votes
1 answer
32 views

Problems with foreign keys in Hibernate

So, I have 2 entities: Room: @Entity @Table(name = "rooms") public class Room { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String type; ...
Xuhe12's user avatar
  • 3
1 vote
1 answer
1k views

Generate persistence mapping feature in IntelliJ IDEA has dissapeared?

I have recently upgraded to IntelliJ IDEA 2024.1. I work with the Hibernate framework and I used very often the 'Generate persistence mapping' feature from the Persistence window but it seems that ...
Jose's user avatar
  • 21
0 votes
1 answer
40 views

Having problems with foreign key in Hibernate

I have 2 tables Room and Guest @Entity @Table(name = "rooms") public class Room { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String type; private String ...
Xuhe12's user avatar
  • 3
0 votes
2 answers
55 views

Automatically remove a child from its parent

@Entity public class Book implements Serializable { @Id private Long bookId; private String title; @ManyToOne @JoinColumn(name = "author_id") private Author author;...
Chris311's user avatar
  • 4,012
0 votes
1 answer
31 views

JPA Mapping : Embeddable Composite Key and Mapping issue

My DB Structure is as follows : Table : product prod_id ... Table : product_category prod_id category_id ... Product_category has Unique contsraint on (...
dhinkatika's user avatar

1
2 3 4 5
65