23,354 questions
1
vote
1
answer
60
views
Spring Boot (4.0.0) Cannot Connect to MongoDB in Docker Compose Network
I'm trying to connect my Spring Boot application (using spring-boot-starter-data-mongodb) to a MongoDB instance within a shared Docker network managed by docker-compose.
The connection is failing, and ...
1
vote
1
answer
61
views
Customize spring data jpa repository's query to avoid fetch eager fields
Let's say I have a spring-boot-based project, that uses spring data jpa to define entities and map them to a postgres db.
The entity has some @ManyToOne annotatated "joins" - with eager ...
0
votes
1
answer
52
views
Spring native query (declare..begin..end) with parameters
I have trouble passing parameters for a native query with declare..begin..end style.
This code doesn't work:
@Test
@Transactional
void foo() {
em.createNativeQuery("""
do
...
0
votes
0
answers
68
views
Spring Boot 2.7.x JPA @ManyToOne join returns empty list on GET, but works on POST
In a Spring Boot 2.7.x application with Hibernate/JPA, there are two tables:
tickets
complaint_id (PK, VARCHAR(255))
attachment
complaint_id (FK, VARCHAR(255))
other fields: id, file_name, ...
0
votes
0
answers
31
views
cant manage to make entity corresponding to entitygraph query
so i am using entity graph to make a dynamic query of a table, the query is being made correctly which is corresponding to my graph and subgraph attribute nodes but when i fetch it as the entity, the ...
1
vote
0
answers
65
views
Hibernate Dirty Checking
I'm using Spring Data JPA with an entity that contains a Map<String, String> field.
The map is stored in the database as a TEXT column (JSON string). JPA automatically stores the map as a ...
-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 ...
1
vote
1
answer
75
views
Why is Spring attempting to use a read-only transaction when I explicitly requested a new write transaction?
I have a service method that performs the following operations in sequence:
Calls a read method annotated with a custom read-only transaction annotation (equivalent to @Transactional(readOnly = true))...
0
votes
1
answer
84
views
Jakarta Persistence (JPA) Specification for a join
I cannot get this JPA Specification to work for a simple join. I know the ""statusLookup.code" when mapping but does not work here. Does anyone know how to get it to work. Its a ...
-3
votes
0
answers
92
views
JPA/Hibernate EntityGraph with Specification and Pagination not loading all related entities correctly
JPA/Hibernate EntityGraph with Specification and Pagination not loading all related entities correctly
I'm working on a JHipster-generated application and need to create APIs that load entities from ...
1
vote
1
answer
91
views
JPA OneToOne Field 'price_id_price_id' doesn't have a default value
how do I resolve that error? Thank to all answers.
org.springframework.orm.jpa.JpaSystemException: could not execute
statement [Field 'price_id_price_id' doesn't have a default value]
[insert into ...
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.
...
Best practices
0
votes
7
replies
195
views
Best way to write an Oracle Procedure using Spring Data Jpa
I am new to JPA and learning it. Now I have an Oracle procedure in system, which now needs to be made DB Agnostic, that can run on Postgres. For that I want to write the same functionality of ...
0
votes
1
answer
50
views
Enable Hibernate @Filter as default in Springboot for soft delete
I defined a Hibernate Filter to filter out the deleted records.
My wishlist:
The Filter should be enabled all the time as default.
Only in special cases when I need the deleted records, then I would ...