All Questions
Tagged with jpa spring-data-jpa
6,036
questions
0
votes
0
answers
3
views
release conenction in JPA multitenancy connection provider
How to handle exception in releaseConenction(String tenantIdentifier, Connection connetcion) method which implements MultiTenantConnectionProvider. How do we ensure the connetcion will be closed if ...
0
votes
0
answers
8
views
Nested Interface Projections in Spring Data JPA
I am working on a spring boot based application where I want to utilize interface based projection as I want to select partial column from my mysql database.
I have a CourseEntity.java class with a ...
0
votes
1
answer
24
views
JPA EntityExistsException thown when saving and object
I have the following 2 objects in my project that share the common Composite Primary Key as and ID:
@Entity
@Immutable
@Cacheable(true)
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@Table(name = ...
-2
votes
1
answer
30
views
JPA get highest value in column with where condition
I'm using a JpaRepository to access a table in my database. I defined the table through an entity. My goal is, to get the highest value in the wordNumber column. But I also have to distinguish entries ...
-1
votes
2
answers
39
views
any scenario's to use @Transactional annotation at Repository delete method?
I am reveiewing the code for one of the senior member for the first peer review so he added @Transactional annotation at custom repository with delete method. The custom Repository delete method is ...
0
votes
0
answers
31
views
Issuse with relationship mapping MapKeyEnumerated with an Entity List as values
I have this Entity
@Entity
public class MealPlanADay {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private Long id;
//@OneToMany(cascade = CascadeType.ALL,...
0
votes
0
answers
24
views
Hibernate seems to ignore the dialect I specify
I'm using Olingo JPA for producing an OData API.
The database I'm connecting to doesn't support the 'LOCATE' function; instead it implements 'POSITION'.
This seems to be true of a few databases: ...
0
votes
0
answers
28
views
How to Convert a Complex SQL Query to Hibernate Criteria API
I'm learning about Hibernate's Criteria API and would like to know how to convert this particular SQL query to Criteria API. Here is the SQL query I’m working with:
select s1.score as score,count(s1....
0
votes
0
answers
21
views
Impossible to use DATEDIFF in java JPA criteria queries?
For the life of me, I cannot figure this out.
I want to select entities from my H2 database, and get the difference between an entities timestamp column and a passed parameter.
trying
var dateDiff = ...
0
votes
0
answers
15
views
Handling Date comparisons in MYSQL 8 and Spring boot without Milliseconds
We are upgrading our project from Mysql 5 to Mysql 8. there is weird issue coming in db queries in date handling.
On MySQL 5, while saving data to db, the date used to be saved with 'yyyy-MM-dd HH:mm:...
1
vote
1
answer
50
views
Issue with @ManyToOne Lazy Loading: Unable to Find Entity by ID
Edit
I added an attribute that can be the problem, it had the same column name in the yEntity and the xEntity, but he is not part of the relationship (the Integer yEntity in yEntity who is a reference ...
0
votes
1
answer
23
views
Why Join attribute appending with join column?
I have two entity
@Entity
@Table(name = "Student")
class Student{
@Id
@Column(name = "Id")
private Integer id;
@Column(name = "name")
private String name;
@OneToMany(...
0
votes
1
answer
42
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
...
0
votes
1
answer
60
views
JPA entity ID field with a SQL Server 2022 Sequence
I am trying to connect my Spring Boot service to a SQL Server 2022 database, but I am having issues with a sequence:
public class SomeEntity {
@Id
@SequenceGenerator(name = "some_seq"...
-2
votes
2
answers
61
views
Java Spring Boot JPA database connection issue
Im working on Java Spring Boot application, and have a problem with connection to database via JPA. JPA cannot connect to my db. I tried many url configurations, but connection failed and such ...