Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
5 views

Hibernate: Generate non-id value from sequence

I have an entity with 2 fields which both use the same sequence, but when debugging I see that only the id field value is being generated: @Table(name = "MY_TABLE") public class MyEntity { ...
Clayn's user avatar
  • 29
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 ...
aryaD's user avatar
  • 3
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 ...
Usama Abubakar's user avatar
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 = ...
Martin819's user avatar
  • 490
0 votes
0 answers
7 views

QueryDSL join(a, b) vs join(b).on(): Why does @SQLRestriction behave differently?

Intro: I'm using QueryDSL with Hibernate in a Spring Boot project. I've noticed a difference in the way @SQLRestriction is applied when using join(a, b) versus join(b).on(). Specifically, when using ...
Goose's user avatar
  • 1
0 votes
0 answers
45 views

Fix naming convention to remove underscores from Hibernate JPA

Without any changes it was prepending the class UserProfile and BaseModel id (user_profile_id). What I wanted was just ID in the table. When I changed to use <property name="...
JustinKSU's user avatar
  • 5,009
-1 votes
0 answers
11 views

Row updated in another transaction error unless there is a breakpoint on the save method

I have 2 methods that update an entity and have similar functionality, but I have inherited the codebase with little testing so don’t want to do a refactor yet. However, there is a bug in one of these ...
iamsimonsmale's user avatar
0 votes
1 answer
16 views

JPA Subquery return object and use on query multiselect

I'm have a java spring application that use a criteria query. The query has a multiselect and one of the values is a subquery that bring an complete entity. The application work on original enviroment ...
Felipe Schultz's user avatar
-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 ...
Fi0x's user avatar
  • 144
0 votes
1 answer
28 views

How to Handle Indexes for @MapsId in JPA: Should FK and PK Share the Same Index?

I am using the @MapsId annotation in JPA to map a foreign key (FK) to a primary key (PK). According to the @MapsId annotation, the FK and PK share the same value. However, when I checked the database ...
Yusuf BESTAS's user avatar
-2 votes
0 answers
22 views

How to set foreign key constraint order by JPA annotation? [closed]

I'm using JPA in a Spring-Boot application with JPA (jakarta.persistence Annotations). The creation of my DB schema (hbm2ddl=create) failed with an: ⚡ Foreign key constraint is incorrectly formed ...
Tobse's user avatar
  • 1,312
0 votes
0 answers
35 views

JPQL did not translated to SQL correctly when using Window Functions

Models: @Entity @Data //This is main entity public class Collection { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @OneToMany(mappedBy = &...
SoT's user avatar
  • 1,143
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,...
Omar122's user avatar
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: ...
Person's user avatar
  • 1
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....
random guy's user avatar

15 30 50 per page
1
2 3 4 5
1652