Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

I'm having trouble managing DTOs. I'm working as follows: I have a reusable DTO called PhoneResponseDTO that is used in both findAll and findByID. Then I created a DTO for each operation like Created, ...
0 votes
0 answers
26 views

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
1 answer
9k views

I have class City which is: @Entity @Table(name="city",schema="rezervisi") public class City { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Getter @Setter private int ...
2 votes
3 answers
10k views

I am trying to add the following query to the JPA repository @Query "select st from Strategy st where st.unId= ?1 order by ( st.totalMargin / st.totalRevenue ) desc" However, this query does not ...
0 votes
0 answers
62 views

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, ...
8 votes
3 answers
13k views

I want to configure a Spring Boot Application so that no DB is used at all. So I have annotated my Application class for excluding JPA autoconfig classes: @SpringBootApplication @...
3 votes
1 answer
1k views

According to the reference, countQuery is required for native queries pagination (at least there is an example with it). But according to my tests (Spring Boot 2.4.5), @Query pagination works without ...
3 votes
3 answers
8k views

According to Spring docs https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.special-parameters returning with List should not issue count query. But with my spring it ...
1 vote
1 answer
66 views

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))...
-2 votes
1 answer
79 views

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 ...
0 votes
1 answer
9k views

I am having a transaction using spring data , and I am trying to do an save operation (insert operation) . [SQL0913] Row or object table in Schema type *FILE in use. Following is the entity @Entity @...
0 votes
1 answer
79 views

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 ...
2 votes
3 answers
192 views

I'm working with these entities: UserEntity: @Entity @Table (name = "users", uniqueConstraints = @UniqueConstraint(columnNames={"name"})) public class UserEntity { @Id @...
1 vote
3 answers
9k views

I am using springBoot, I want to map OneToMany relationship from parent to child. Directly using entity with eager fetching I get recursive records, therefore, trying using ModelMapper for DTO mapping ...
1 vote
1 answer
11k views

I run a Spring Boot Application wiht @EnableTransactionManagement and want to use @Transactional(readOnly = true) for some database queries. But I receive a confusing error message. I'm using Spring, ...
0 votes
1 answer
67 views

I'm working on e-commerce APIs, I have this service that is responsible for the cart operation: @Service @AllArgsConstructor public class CartService implements ICartService { private final ...
Best practices
0 votes
7 replies
187 views

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 ...
2 votes
2 answers
11k views

I have a user profile class that includes a field which is a list of enumerated roles: enum UserRole { USER, ADMIN; public static final int MAX_LENGTH = 5; } @Entity @Table(name = "...
0 votes
1 answer
42 views

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 ...
2 votes
2 answers
11k views

I'm using springboot 2.1.2 and I encounter some problems with repository. Here are my entity classes: @Entity @Getter @Setter @NoArgsConstructor @Table(name = "orders") public class Order { @Id ...
1 vote
1 answer
93 views

I have the following (oversimplified) code, that performs an unionAll between two tables using Criteria API, and retrieves a projection given by ProjectionDTO. These entites are just examples. public ...
0 votes
2 answers
9k views

I am facing an error telling autowired dependencies are failed. I tried all that I can do and I checked many forums and stackoverflow but I couldn't figure out what's going wrong in it. I am ...
2 votes
1 answer
12k views

I'm getting this exception Caused by: java.sql.SQLException: An operation is being attempted on a closed connection. ------------------------ Cause of Close --------------------------------- ...
1 vote
2 answers
81 views

I created a simple project with contains only one Entity which inherits from AbstractAggregateRoot and tries to register an event during the @PrePersist JPA lifecycle event. @PrePersist fun ...
0 votes
1 answer
62 views

I recently upgraded my application to Spring Boot 3.1.4, Java 21, and Hibernate 6.2.9. Since the upgrade, I am encountering the following error when trying to save JSON data into my database: WARN 1 -...

1
2 3 4 5
468