All Questions
2,257 questions
0
votes
0
answers
81
views
MySql database connection with Jakarta ee via JPA and Wildfly
i've been developping an app for a uni project and i started with 3 simple tables (Student, Teacher and Subject), but when i try to list all the subject in the Controller servlet it shows an error on ...
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 ...
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 ...
2
votes
0
answers
137
views
How to define a UUID identity column that satisfies both MySQL 8.4 and H2
I'm trying to implement a table that uses UUID instead of long as its identity column.
The long id implementation works perfectly, including end-to-end Spring MVC tests:
@Getter
@Setter
@Entity
@Table(...
0
votes
1
answer
100
views
Exception MysqlDataTruncation when parsing a String 1899-12-30
public Timestamp convertFromDate(String fromDate) throws ParseException {
String[] possibleFormats = { "dd/MM/yyyy", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd" };
...
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")
...
0
votes
2
answers
63
views
Why doesn't the n+1 problem occur in the constructor passing entity fields?
I checked the behavior of SQL when we want to have values mapped immediately from an Entity to a DTO object, for example. If I gave an example in the constructor:
SELECT new Test(T) FROM Test T
I saw ...
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
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(...
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(
...
0
votes
0
answers
31
views
ORM connection behaves differently for two different codes
I had two different codes and I needed to make an ORM connection and create a table out of the given code:
code 1:
package com.scm.entities;
import jakarta.persistence.Column;
import jakarta....
0
votes
1
answer
182
views
Could not determine recommended JdbcType for Java type 'java.util.Map<java.lang.String, java.util.List<java.lang.String>>'
I am having this error:
Caused by: org.hibernate.type.descriptor.java.spi.JdbcTypeRecommendationException: Could not determine recommended JdbcType for Java type 'java.util.Map<java.lang.String, ...
1
vote
1
answer
54
views
Tables are not getting created into the MySQL DB using Springboot Application
i am creating a new backend APIs for the online shop, I have created entities class for item, cart, user etc. However, when I am running the app the tables are not getting created in the DB.
I am not ...
1
vote
1
answer
80
views
How to build a JPA Specification for a given SQL query with entities on Many to Many relationship?
I have the following entities:
@Entity
@Table(name = "advertisement")
public class AdEntity {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
private String id;
@...
-1
votes
1
answer
87
views
Repeated column mapping in many to one relationship (Spring JPA)
When I run my springboot project, I get error:
Column 'transactionNumber' is duplicated in mapping for entity 'com.myproject.Entities.IndividualItemsTransactionEntity' (use '@Column(insertable=false, ...