Questions tagged [constraintviolationexception]
17 questions
1
vote
0 answers
ConstraintViolationException while running an update using JPQL
I ran into an issue with this update query:
UPDATE RankingPosition rp SET rp.position = rp.position + 1 WHERE rp.ranking = :ranking AND rp.position >= :position
I have specified a unique constraint on the position column. The query violates the…

hyperion
- 119
- 5
1
vote
1 answer
Is it possible to ignore foreign key conflicts on insert with sqlite?
Here is an anonymized representation of two tables I have:
create table if not exists master_node (
book_name text primary key on conflict ignore not null
);
create table if not exists category_table (
book_name text not null,
category…

Grant Williams
- 1,469
- 1
- 12
- 24
1
vote
1 answer
Kotlin Hibernate @ManyToOne MERGE violates foreign key constraint (Postgres)
I implemented a @ModelToOne Relationship and would like to use a Dropdown List via Thymeleaf. I use a separate formular to persist PlaceEntities and a formular for WorkEntities where a appropriate Place can be selected from the mentioned dropdown…

Laroux89
- 45
- 5
1
vote
1 answer
Hibernate method validation NOT always working
Why is Hibernate's validation - ConstraintViolationException - NOT thrown in main() of a SpringBoot app (SpringBoot's latest version) with spring-boot-starter-web:
@Validated
@SpringBootApplication
public class Application {
public static void…

enhancedJack
- 265
- 1
- 6
- 15
0
votes
0 answers
i get the ConstraintViolationException while persisting. The error message provided below
get the ConstraintViolationException while persisting. The error message provided below:
jakarta.validation.ConstraintViolationException: Validation failed for classes [com.Shop.Bird.Models.Product] during persist time for groups…

Black8ird
- 1
- 1
0
votes
1 answer
ConstraintViolationException won't be thrown
When I launch my request, the ConstraintViolationException does not want to be thrown for a field with a regex in the contract
Here the request in postman
apiName/v1/account?cardNumer=55^fields=customerName
Here the contract AccountApi with a…
0
votes
1 answer
java.lang.LinkageError: loader constraint violation Jenkins maven
I am testing an upgraded version of Jenkins (from 2.235.1 to 2.375.1). One of my jobs fails with the following error when run in Jenkins Agent with Swarm Client 3.39 (this works perfectly on previou sversion):
After reading up a bit more I think…

NaushadNaleer
- 1
- 1
0
votes
0 answers
handleConstraintViolationException in a controller advice
I use spring boot 3, I search to centralize error handling about validation
public record RepoPubRecord(
@NotEmpty(groups={Intranet.class,Extranet.class}
Long idRepoPub,
@NotEmpty(@NotEmpty(groups={Extranet.class})
…

robert trudel
- 5,283
- 17
- 72
- 124
0
votes
1 answer
Why can't I catch ConstraintViolationException in Hibernate?
I suppose this must be a very basic question.
I relaunch this code which tries to insert an already existing row in a table but the ConstraintViolationException is catched in the general catch (Exception e) block insted of being catched in the…

errorrelativo
- 11
- 5
0
votes
1 answer
Hibernate do not save entity with last-available ID - ConstraintViolationException
I am having a problem with my code. I have created an entity "Comment" with relations Many-To-Many to entities Movie and User (User may comment many movies, and movie can be commented by many users). When I am saving new Comment entity, Hibernate is…

krystian14d
- 3
- 2
0
votes
2 answers
How to test ConstraintViolationException with assertJ?
If I have a bean like
@Data
@Validated
@EqualsAndHashCode(callSuper = true)
@Document(collection = "Xxx")
public class XxxDocument extends Zzz {
@Min(0)
@Max(255)
private Integer aProperty;
}
How can I write a test using assertJ that…

du-it
- 2,561
- 8
- 42
- 80
0
votes
0 answers
Jpa entity same record duplicated and making unique key violation
I am using Jpa, my website is shows a form in 3 steps, in every step i'm making save() in many steps :
First save() will create a record A with a primary key id and another unique key userId, data as firstname and lastname
Step 2 is where the user…

Sushi
- 646
- 1
- 13
- 31
0
votes
1 answer
Can I specify EntityTransaction transaction order?
We've having a problem doing an insert into two tables in a single transaction in our H2 database using EclipseLink JPA.
The database schema looks something like ...
Table A {...,
IP_ADDRESS Varchar2( 15 ) not null
}
Table B {...,
IP_ADDRESS…

Warren
- 179
- 2
- 7
0
votes
0 answers
Spring DATA JPA onetoone unidirectional mapping CASCADE.ALL insert duplicate child row, not update
I am writing an Entity class Result, and it has a ONETOONE mapping to another entity UpstreamResult.
When I do a save() method. In a spring boot concurrence situation, sometimes, the child entity get inserted not updated and throw …

Zha Jikun
- 11
- 2
0
votes
0 answers
Django: Value violates not-null constraint, however Value is not part of the model being created
When creating a new "Cast" record via the Django admin, I'm told "image_cover" attribute is null, but that attribute isn't even a part of the "Cast" model. Why would this happen?
The Error:
django.db.utils.IntegrityError: null value in column…

Michael Romrell
- 1,026
- 5
- 15
- 31