All Questions
5,596 questions
0
votes
0
answers
31
views
Hibernate 6 error using `manyToOne` and `oneToMany` mapping - Why is this happening? [duplicate]
I have two entity classes defined. One called EncryptedFile and the other called Chat.
I have stripped out the code down to the root problem.
Chat:
package database.objects
@Entity
@Cacheable
@org....
0
votes
1
answer
57
views
How can I get hibernate to do a unidirectional ManyToOne mapping without using the primary key?
We have a table structure like this:
CREATE TABLE `client` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `member` (
`id` BIGINT NOT ...
0
votes
0
answers
29
views
Portable ID generator in Hibernate (For Oracle 11G and Mysql 8.0)
Background
I am trying to migrate my database form Oracle 11G -> Mysql 8.0. I am using hibernate as my ORM layer (over spring boot app)
Problem
While migrating to mysql, i also need to change my id ...
1
vote
2
answers
28
views
org.hibernate.MappingException: Unknown entity: org.example.Person
I am trying to save a record of Person class into mySql database using pure java and hibernate but I get this error. these are my classes. I appreciate any help why this error is raised.
With these ...
1
vote
0
answers
48
views
Dropwizard - new entities not commiting
We have a thread that queries external systems by clients. It receives a JSON array containing client information like id (which our system calls "customId"), name, phone, etc. The array is ...
0
votes
0
answers
21
views
How to Handle Missing Data in LEFT JOIN for Custom Fallback Message in JPA Query?
I'm building a Spring Boot application where I need to fetch data from an AuditLog table. This table is connected to several other entities through LEFT JOIN, and one of those entities is ...
0
votes
1
answer
84
views
Java JPA Repository One To One Join Table Wrong Join Variable and Unknown Column Error
I am struggling to get a one to one join relationship JPA repository call to work.
I have two tables product and display_name so I made the follow entities
@Entity
@Table(name = "product")
...
1
vote
1
answer
48
views
How is JPA's Sort.by() is able to access nested fields of entity?
I am getting a surprising output in my GET API built in springboot,
I have two related entities, say A and B. Here A has @OneToOne mapping with B.
@Entity
class A {
....
@OneToOne
@...
0
votes
1
answer
73
views
How to resolve circular foreign key constraints with NOT NULL in Hibernate
I'm dealing with a cyclic dependency issue between two entities (Store and Staff) in MySQL, which is causing issues when trying to save data using Hibernate ORM (version 6.6.0.Final, no Spring). The ...
0
votes
0
answers
49
views
Persistence criteria Fetch with treat to specific type
orderItems can be 2 types, StandardOrderItem and SpecificOrderItem.
I want to get them fetching to avoid LazyInitialization exception.
It should be like this:
orderService.findOrderByIdAndEntityGraph(...
1
vote
1
answer
102
views
How to find sum of multiple columns in where clause
In my application I have an accounting table with columns amount, paidAmount, fine. Here I need to find accounts with balance zero by adding these 3 column and matching it with zero.
Below is my hql ...
2
votes
0
answers
42
views
JPA @Modifying Update query with where clause relations error
Im having a weird case where I have a repository with a very simple query .
@Modifying
@Query("update Test t set t.worker = :workerToEdit where (t.product.deleted = false)")
void editTest(
...
-1
votes
1
answer
74
views
Hibernate - Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 but im using .save() only
I was wondering why I am having this issue when I am only doing a .save() on the db? I cannot figure this one out for some reason.
my Entity:
@Component
@Entity
@Data
@NoArgsConstructor
@...
1
vote
1
answer
19
views
Connection issue in hibernate
I need to connect my song class with the database using hibernate. But, hibernate is not connecting and excutting the queries. I used several methods and several dependencies of hibernate but still it ...
0
votes
2
answers
109
views
Error Code: 1364. Field 'userid' doesn't have a default value
This is the error:
java.sql.SQLException: Field 'userid' doesn't have a default value at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130) ~[mysql-connector-j-8.3.0.jar:8.3....