I’m working on an application with following Entities and code: The RestController for MotionPicture: My DB Table: clip columns: id(1-100 unique), date, size Table: motion_picture columns: id(1-100 unique), date, size, duration association table: motion_picture_clips columns: motion_picture_id (1-100 random), clips_id (1-100 unique) When I run the programm and make a the getRequest in Postman (getById and getAll) –> I’ll get duplicated
Tag: mysql
Register form only works if user is already logged in
I created a Spring Boot web application, and it is connected to a local MySQL database. I have a template called “login.html” which has a login form, as well as a register form in it. This is the template “login.html”: In the MySQL database, I have many users with an email address and password. With these credentials, I can login
Why my trigger is not working with Hibernate?
I have a Java spring boot project and I use Hibernate in this project. I have a void deleteAll(List<Long> idList) method and its query is @Query(value = “DELETE c FROM Course c WHERE c.id in :idList”, nativeQuery = true). I want to use a trigger after every delete operation. I created a trigger in mysql and it works when I
Calculate time from date taken with different timezone
I have a MySQL database which is storing a datetime value, let’s say 2020-10-11 12:00:00. (yyyy-mm-dd hh:mm:ss format) The type of this date (in mysql) is DATETIME When I retrieve this data in my controller, it has the java 7 type “Date”. But it adds a timezone CEST due to my locale I suspect. Here I already find confusing that
Connecting Java with a localhost, problem with my code [closed]
to make it short, the next code import java.sql.*; public class Prueba{` public static String user=”Boss”; public static String pass=”123456″; public static …
why if i make JTable take data from database delete the first row?
I’m trying to make a Table take the data where I make condition a delete from … to … , the data returns one row thinner, maybe one row deleted? my code: Answer the data come to me less thin a one row You read the first row outside the loop, so it is never added to the model. Your
The dreaded Java SpringBoot app not connecting to MySQL with Docker-compose java.net.ConnectException: Connection refused
I have been struggling with the following issue – the dreaded Java SpringBoot app not connecting to MySQL with docker compose exceptions: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure JDBCConnectionException: Unable to open JDBC Connection for DDL execution java.net.ConnectException: Connection refused The app works fine on its own, but it can’t seem to connect to mysql once I get it in Docker. I
Spring Boot :Deleting a blog posts shared tag only when the last post that has it is deleted
I have a dilemma trying to get a solution for this issue. I have two (can be any number) blog posts that share the same tag. I have a set of tags for each added post so duplicate tags are not possible, so lets say I add first post with the tags “car” and “blue” and the second post with
Does Hibernate HQL Support Regular expression pattern matching?
I was testing different ways of data retrieval from my database (MySQL) using Hibernate. And I get to know that it is possible to use LIKE in HQL just like we do it in SQL. But when I tried REGEXP I got the following error I have also tried the different forms like RLIKE and REGEXP_LIKE. But the error is
Spring Data JPA Distinct Returning Duplicate Values
In my Spring boot application I have a query which should return a distinct List of Focus’ (works perfectly in MySQL) However this does not return distinct values, duplicates are contained in the resulting list. Another issue is that I can’t return a whole entity using @Query annotation – changing my query to SELECT DISTINCT(F) FROM Focus F gives the