52,181 questions
0
votes
0
answers
66
views
Mapping an entity with an embedded key
There is a class with an EmbeddedId.
@Entity
@Getter
@Setter
@Table(name = "indicator_values")
public class IndicatorValue {
@EmbeddedId
public IndicatorValueId id;
@Column(...
0
votes
0
answers
56
views
"DefaultJpaDialect does not support custom isolation levels" when upgrading to spring batch 5
I am upgrading an app to newest Spring Boot 3, and because of that Spring Batch is upgraded to 5.2.3 (from 4.3.10).
The application did not persist batch states previously, it was using the "map ...
Advice
0
votes
0
replies
17
views
Can JPA persist null-element-containing Byte[] or Character[]?
According to the 2.6. Basic Types, Byte[] and Character[] may be mapped, yet as discouraged.
And then can the array may contain null elements?
-1
votes
0
answers
169
views
EclipseLink Converter autoApply=true not working
I have an entity with an enum class field :
@Entity
public class Trade {
@Id
private Long id;
@Column(name = "kind")
private TradeKind kind;
}
Here the enum ...
-3
votes
1
answer
85
views
Converting from Java model to JPA
I have implemented a class User that represents a User (so far either a Student or a Teacher). What they have in common is that they both have IDs, and some information about the user (this is stored ...
3
votes
0
answers
56
views
Hibernate OptimisticLockException in Java 21 – works fine in Java 17
Title:
Hibernate OptimisticLockException in Java 21 – works fine in Java 17
Body:
I recently upgraded my project from Java 17 → Java 21, and one of my Hibernate test cases started failing with this ...
1
vote
0
answers
84
views
How to pass client location into custom JPA ID generator?
Working on a scalable custom ID generator in JPA. The format I want to achieve is:
<first three letters of country or region> + <year> + <sequence number>
For example: USA2025001
I'm ...
5
votes
1
answer
156
views
Integrating a Jakarta Persistence implementation with modular JavaFX/Maven/JLink app
Quick background information for context: I'm writing a relatively small tool for a small gaming community to download and manage user generated content. It's a modular Java 24 + JavaFX Project done ...
1
vote
2
answers
110
views
Hibernate 6 unidirectional many to one relationship and database cascading deletes
I have an extensive JPA model which exclusively uses unidirectional @ManyToOne relationships from child to parent, for example like this.
public class Child {
@ManyToOne(optional = false)
@...
0
votes
1
answer
66
views
How to implement post remove behavior on a JoinTable using EclipseLink jpa?
Having unidirectional ManyToMany mapping in an entity called A to entity called B on field called files:
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = JOIN_TABLE_NAME)
private List<B> ...
0
votes
0
answers
53
views
Java object DB fields not updated
public void toggleBlacklistPatient(Patient patient, boolean blacklist){
if(patient == null || patient.getId() == null){
return;
}
if(blacklist && !...
2
votes
3
answers
203
views
JPA recursive hierarchy read - StackOverflowError with FetchType.EAGER but LazyInitializationException with FetchType.LAZY
I'm working with these entities:
UserEntity:
@Entity
@Table (name = "users", uniqueConstraints = @UniqueConstraint(columnNames={"name"}))
public class UserEntity {
@Id
@...
1
vote
2
answers
106
views
Out of Memory when deleting comment-classes with childstructure
I use Hibernate for a project. It's a ticket system.
For that I created comments with childcomments.
But every time I want to delete a comment, hibernate escalates and tries to load just EVERYTHING.
...
0
votes
0
answers
63
views
How do I define a bridge table/many-to-many relationship in my schema for use in a Spring JPA BE?
I'm working on a personal project to get better understanding of BE/architecture/how everything ties together, but I'm having trouble finding examples that show the full picture. Right now, I'm ...
-3
votes
3
answers
255
views
How can I generically convert a String value into an instance of a given Comparable type in Java?
I’m trying to implement a generic utility method that takes a String value and a Class<?> type, and returns an instance of that type.
The context: This value represents data from a JPA column, ...