I have a little problem with mysql + hibernate. in the database I have: I don’t have any record of January 13th 2023 if I perform a query to get this information of the January 14th 2023, in the code I get this: I don’t know why if in the database I have 14-jan-23 in the code I get: 13-jan-23
Tag: mysql
SpringBoot ManyToOne saving to database issue – getting error: Field ‘user_id’ doesn’t have a default value
My situation is this: I am creating a marketplace where users can buy and sell products. I am trying to list a product with a ManyToOne relationship with the logged in user. I am getting the error: Field ‘user_id’ doesn’t have a default value. Im guessing this is because I haven’t set the user_id but I’m not sure how to.
Java spring hibernate JPA @ManyToAll findAll() slow on large data, many subqueries created
I have 2 classes, Aircraft and Operator, with a one to many relationship from Operator to Aircraft. A findAll() call on the Operator table, which has around 10k rows, from the JPA Repository runs quickly, in just a few seconds, but the findAll() call on the Aircraft table, which has around 65k rows, sometimes takes minutes to execute. Also, I’ve
How to reproduce Java MessageDigest SHA-1 secret key to be used in MySQL AES_encrypt
I have a function to prepare secret key for encryption and decryption using Java: However, for the old records from database, I would like to manually encrypt using a MySQL query. I have tried using the query below, but the result is different from the result by the Java application. Anyone can advise? or is there any other method to
Can’t create one_to_one relationship: Unknown mappedBy in
I try to create an OneToOne relationship between two tables but I receive errors. I used a lot of tutorials but nothing helps. For example baeldung tutorial: Project structure: The error: Gradle: application.properties: Answer You need to use a field name for mappedby, not a column name. In you case, it should be @OneToOne(mappedBy = “personalData”).
Difference between generating UUID in Java and MySQL
I need to insert random id into one table and add that id to another table as foreign key. So I am not sure how to save UUID() if I generated it in MySQL but if I generate it in Java I can just save it into a variable. I wonder are there any drawbacks if I generate it in
Check if any value in list satisfies a condition
Suppose I have the following table called Seasons: … start_month end_month … 2 6 … 3 4 … … … I need to write a query which, for a given list of months, returns all the Seasons that satisfy the condition where at least 1 month in the list is: start_month <= month <= end_month. I’ve written this query as
Variable returns null
In my project ,I need to pass the “price” value which is retrieved from the database in “Availability.java” to “display.jsp”.I have achieved it, but the problem is…. I also need to pass the “price” value from “display.jsp” to “seat.jsp”. When I tried, it returns null value for the price variable. Availability.java display.jsp seat.jsp How can I achieve this? Kindly answer
Get values from User and update into mysql database in Springboot Controller
I’m developing a Banking system Project Where User Should be able to create an account in any available branch. Branch Creation will be maintained by admin. I had two tables(Entities) like BranchDetails and AccountDetails. The BranchId Column is the primary key in BranchDetails and Foreign key in AccountDetails. Now When user Creates an account, he will input the Preferred Branch
Universal solution to insert Userinput values in MySQL database with a priori unknown columns with Java and for example PreparedStatements
I want to insert a whole set of values in my table in MySQL (e.g. This works in MySQL Workbench 8.0 but not in my Java Code. I read the JavaDoc about prepared Statements but I didn’t find any clues on inserting values if I don’t know the type a priori. My Java code looks like this: I tried many