All Questions
3,602
questions
0
votes
1
answer
28
views
How to Handle Indexes for @MapsId in JPA: Should FK and PK Share the Same Index?
I am using the @MapsId annotation in JPA to map a foreign key (FK) to a primary key (PK). According to the @MapsId annotation, the FK and PK share the same value. However, when I checked the database ...
0
votes
0
answers
28
views
How to Convert a Complex SQL Query to Hibernate Criteria API
I'm learning about Hibernate's Criteria API and would like to know how to convert this particular SQL query to Criteria API. Here is the SQL query I’m working with:
select s1.score as score,count(s1....
0
votes
0
answers
15
views
Handling Date comparisons in MYSQL 8 and Spring boot without Milliseconds
We are upgrading our project from Mysql 5 to Mysql 8. there is weird issue coming in db queries in date handling.
On MySQL 5, while saving data to db, the date used to be saved with 'yyyy-MM-dd HH:mm:...
0
votes
0
answers
45
views
JPA repository findBy return different result when using H2 and MySQL
This is the simply version of my application.
I have 2 entity.
Customer.java
package com.udacity.jdnd.course3.critter.user;
import java.util.List;
import java.util.ArrayList;
import com.udacity.jdnd....
0
votes
0
answers
20
views
[spring-boot]open api can't be stored in mysql database
bonjour,
I have a unsolvable problem ... help me
I downloaded XML open api file and parsed that in spring boot.
Even though mysql db was successfully connected, data wasn't stored in my db table.
Only ...
0
votes
0
answers
21
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
39
views
Anyone can translate this JPQL to mySQL
@Query("SELECT u FROM User u LEFT JOIN FETCH u.roles WHERE u.email = :email")
Optional<User> findByEmailWithRoles(@Param("email") String email);
I like to use mysql but this ...
0
votes
0
answers
30
views
I would like to know why this API takes 10 seconds
I'm trying to measure time when loading data using jpa and mysql in spring boot.
Product.java
@Entity
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Table(name = "tbl_product&...
0
votes
1
answer
27
views
Hibernate JPA gives Duplicate entry for PRIMARY KEY while saving new object after manual sql execution in db
I'm using JPA for mysql operations, but after some manual operations in the database (e.g. insert, delete, dump, etc..) when an entity is saved using Repository.save(entityModel). I get this error -
...
0
votes
1
answer
48
views
JPA query for json column search
{
"store_ids":[
{
"name":"Gupta General store",
"store_id":"SSC10000020"
},
{
"name":"...
0
votes
1
answer
29
views
OpenJPA and AttributeConverter beween Calendar and mysql DATETIME not working
OpenJPA3.2.2 supports AttributeConverter but I always get a cast error.
class java.lang.String cannot be cast to class java.util.Calendar (java.lang.String and java.util.Calendar are in module java....
0
votes
0
answers
19
views
Im New To JPA and Hibernate I would like to know if this is an acceptable way of Fetching Data using JPA
There are three types of users
users with ROLE_User
users with ROLE_Admin
users with ROLE_User and ROLE_Admin
I wrote a query that filters out all users with admin access
in MySQL
SELECT *
FROM ...
0
votes
1
answer
97
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, ...
0
votes
1
answer
41
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
61
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;
@...