Category "hibernate"

Inconsistency between postgres and hibernate

Inconsistency between hibernate and postres. Consider we have table student having 2 columns id(Primary Key) and name. Perform the following concurrent query on

JPA cascading delete fails with custom delete method

I ran into an error with custom delete method in spring data jpa. Basically there's a bag which contains items, and when deleting the bag, all the items in it s

Hibernate: How to create multi-column index on join table

I have two entity classes: Taco @Data @Entity @Table(name="Taco") public class Taco { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @

MantToMany - Cannot add or update a child row: a foreign key constraint fails

I am trying to create Many to Many relationship and save some data to database. I have entities: @Data @AllArgsConstructor @NoArgsConstructor @Entity public cla

In DB MySQL the index already exists for the column, should I add the index in the Hibernate Entity?

If the column has already the index "INDEX_VALUE" in DB MySQL. Do I still need to add in hiberante Entity? @NamedQuery(name = "", query = "SELECT e FROM Entity

JPA Hibernate OneToOne children enity always fetches parent entity

I am having a problem with a OneToOne relationship. Trying to load a children entity will always result in an additional query that loads its parent, even if I

Why Hibernate cant create DB? SQLSyntaxErrorException and CommandAcceptanceException

I have three DBs, of which hibernate can only create 2/3. Can someone explain why hibernate can not create a third table "goods" 1: org.hibernate.tool.schema.sp

How can we assign a field of user table say id that is primary key, to another table as a primary key? using hibernate

See I dont want any mapping but what I want is just a simple thing that is.... I have two Entity Tasks(taskid,taskname.....,userId) User_Credentials(userId,pass

Spring: Not-null property references a null or transient value

I have an entity(Car) and i want to add records belong this entity with postman. My entity has one relational connection with User entity. When i want to add a

How can I do a loop "do/while" to insert some data to Postgres Database?

I did this class to do the inserts but every time I need insert again, I need initialize the method main of this class again. Because it is in just one cycle. p

java.sql.SQLException: Column 'serialnumber' not found. (spring boot)

I am writing to-do list web app with spring boot. I Have 2 entities: User (fields: userid (ID), username, password Item (fields: serialnumber (ID), task, userid

Hibernate produces broken query

I have an entity that is mapped to the database table by Hibernate: @Entity @NoArgsConstructor @Getter @Setter @FieldNameConstants public class Set extends Abs

First time SQL query is taking More time from Spring Boot application

I have to fetch some records and then display in output. In my Spring Boot Application, I am using JPA Specification for creating Criteria and then calling repo

Hibernate : functionnally calling hibernate to recreate constraints

I have been deferring my hibernate DDL usage time after time, from create-drop, to update and now i'm using other tools for database migration, and, while still

JPA/Hibernate: Named Query vs Native Query | Which one to use?

There is native query written by developer String sql = "Select * from TERP_META where id=" + id + " and type='KCH' ORDER BY ID ASC"; return entityManagerMaster

Is there a @LastAccessedTimestamp in JPA

I want to store the last read time in a Date column when ever someone tries to load or fetch(select query, findBy methods) a entity I had a look at @PostLoad as

Are query results cached by Java/Hibernate?

Our codebase has a lot of examples of the following code: singleResult = q.list().isEmpty() ? null : q.list().get(0); and I'm currently in the process of repla

Are query results cached by Java/Hibernate?

Our codebase has a lot of examples of the following code: singleResult = q.list().isEmpty() ? null : q.list().get(0); and I'm currently in the process of repla

Why get 403 Forbidden while click on login [duplicate]

I am working on Spring MVC project. I use Spring Security for secure the url of my project. While i click on login button login succesfully bu

Hibernate envers revision throws exception when use @OrderBy

I have 2 entities and use Hibernate envers and Spring envers for auditing @Data @ToString(exclude = {"groupReportPrices"}) @EqualsAndHashCode(exclude = {"groupR