Skip to content
Advertisement

Tag: hibernate

How to annotate Map with JPA?

The app’s stack: Spring MVC, Spring DataJPA, Hibernate. There are three entities: student, tutor, theme. Theme: Student: Tutor: For save student-tutor-theme relationships i want use this table (PostgreSQL): How i can to annotate tutors and students fields in entities, for their content correct persists in this table? Answer Like @kolossus mentioned: Use the @MapKeyJoinColumn¹ annotation, so that the classes (or

How to cascade delete set of enums in JPA?

I have the roles field in User entity: when I try to delete user with a query, the referential integrity constraint violation occurs, because user is referenced from User_roles table. How to solve this in any way? DDL for related table shows i.e. it doesn’t contain ON DELETE CASCADE clause. I need it be there. Answer You can add ON

Hibernate error “operator does not exist: bigint = character varying”

I’m using hibernate to read my database datas but i’m having a issue with the relationship of the tables when i run a query. And i don’t find the reason That’s the error: 2021-01-23 18:16:55.427 WARN 1192 — [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42883 2021-01-23 18:16:55.427 ERROR 1192 — [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: operator does not exist: bigint

Hibernate’s setparameterlist not working for the selectquery

i am trying to set the parameter lTList in the sqlquery with something like this => [‘a’,b’,’c’] but when i SOP after setting the parameter there is no change => “select …. lt in (:ltList) ” what am i doing wrong There is no error but: query constructed : select …. lt in (:ltList) query wanted : select …. lt

HIbernate “StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1”

When an existing user makes a request the method first deletes the oldest record before saving the new request. The code below works fine IF the requests don’t come in too rapidly (using an Oracle DB). Output: However, if the user were to submit requests in a very quick fashion, i.e. happy clicker, the same code generates a StaleStateException error.

Duplicates in Output Java Spring Boot JPA

I’m working on an application with following Entities and code: The RestController for MotionPicture: My DB Table: clip columns: id(1-100 unique), date, size Table: motion_picture columns: id(1-100 unique), date, size, duration association table: motion_picture_clips columns: motion_picture_id (1-100 random), clips_id (1-100 unique) When I run the programm and make a the getRequest in Postman (getById and getAll) –> I’ll get duplicated

Advertisement