All Questions
1,403
questions
0
votes
0
answers
47
views
Spring JPA using Stream as batch read together with JOIN FETCH not work
I am writing a cron job to fully dump some tables from a database to a CSV file. The table content is quite large, with more than 1 million records, which is why I chose to use JPA Batch Reading. I ...
0
votes
0
answers
40
views
Supporting JPA Sequence and UUID IDs at the same time
I would like to support UUID and Sequence IDs in my JPA entity class in different situations.
Case 1: For existing deployments I would like to use the sequence number
Case 2: For new deployments I ...
2
votes
1
answer
78
views
How to use JpaRepository method in the Jpa Entity Lifecycle callbacks?
How to create new Transaction in the @PostUpdate JPA Entity Lifecycle methods? I am not able to @Autowire the AuthorRepository method there and it's always coming null.
package com.bookstore.entity;
...
-1
votes
1
answer
33
views
How to fetch inversely joined entities in a single query?
I have 2 entities, Student and Note:
@Entity
public class Student {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID id;
@OneToOne(fetch = FetchType.LAZY, mappedBy = "...
0
votes
1
answer
177
views
Cannot create a table in H2 with a custom enum
We have an entity, let's call it Test.
@Entity
@Table(name = "TEST", schema = "KAA")
public class Test implements Serializable {
@Id
@Column(name = "ID", ...
0
votes
0
answers
43
views
JPA criteria select multiple fields from subquery
I have the following SQL query that I'm trying to write using Criteria JPA.
select op3.* from operator op3 where (op3.mp, op3.date_to, op3.date_from) in
(select op.mp, op.date_to, op.date_from from ...
0
votes
0
answers
605
views
Spring boot 3, javax.persistence and entity scan
I know there are lots of questions and discussions about spring boot migration from 2.7 to 3.x, but I was not able to find an answer on my (specific) problem.
I have a plugin that is needed by 2 ...
0
votes
0
answers
101
views
Joining pageable tables without relation using JPA criteria
I have two tables with no modeled relations. in my custom repository like below:
Method one
public Page<HistoryTable> findInquiryhistory(InquiryRequest req, int pageNumber, int pageSize){
...
1
vote
1
answer
72
views
JPA ElementCollection foreign key mapping error
My simple Entity class looks like this -
Entity
@Table(name ="my_class", uniqueConstraints = {@UniqueConstraint(name = "AAndBAndCAndD", columnNames = { "A","B",&...
0
votes
1
answer
32
views
SpringBoot JPA in MySQL
I defined this class:
@Entity
@Table(name = "t_planets_tropical")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PlanetsTropical {
@Id
@GeneratedValue(...
0
votes
1
answer
203
views
In JPA2 and Java 10, how do I map the value of an enum to an @Enumerated column?
I'm using Java 10. If I define an enum like this
public enum MyEnum {
NAME1("value 1"),
NAME2("value 2"),
...
}
and then I have a JPA-mapped database column that is ...
2
votes
1
answer
92
views
can do this with JPA / Hibernate criteriabuilder
I am working with oracle and using JPA with Hibernate, can we do this with criteriabuilder?
SELECT col1,col2,col3
FROM table(schema.fn_name(param1,param2,param3))
ORDER BY col1,col2;
the query can ...
1
vote
1
answer
67
views
Shared column between FK and PK
I have two tables, A and B (not defined by me, inherited from old legacy software), with the following structure:
A: PK (idA, ente),
B: PK(idB, ente), FK(idA, ente) --> A
I need to use @IdClass/@...
1
vote
0
answers
237
views
"No explicit selection and an implicit one could not be determined" error for my JPA request
I have three SQL tables
The "Accedant" table that has an idAccedant
The "Emetteur" table that has an idEmetteur and a foreign key towards the Accedant table
The "...
1
vote
3
answers
603
views
How to begin transactions, In Spring boot JPA
I have a composite unique constraint in the database and i wish to violate it inside the transaction but it will be upheld after i call commit.
It's pretty basic database transaction, but i am not ...