I just noticed that when you try to execute a query that does not have required permissions (only tested on a mysql 5.7 database using the mysql-connector-java v8 driver) it is translated to a org.springframework.jdbc.BadSqlGrammarException. This is because the mysql driver itself throws a java.sql.SQLSyntaxE…
Tag: mysql
Two bidirectional association at the same entity – Column cannot be null
I have a scenario where I have a relationship between two tables. One being the step and the other being to know who is the next step. select * from cpo_workflow_step_control; Step entity: Step_Control My problem is, when I try to save a Step, with a Step_Control associated, JPA tries to save everything and i…
Why my query return empry list and gives no error? Java Spring Jpa Repository
Here is my entity class: Here is my Repository: And my controller: Here is my Database: My Database Edit: Here is my ErgebnisseRequest class: So the repository.findAll() gives me all the data from the database. But when i am trying to search by Material it gives me a emptylist and no error. I try all of it li…
Communication link failure in mysql jdbc driver
I’am not able to establish connection with mysql from java using this code It’s throwing me this error The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. The driver has not received any packets from the server. No approp…
Non-Redundant Hibernate List-Mapping (OneToMany)
In a database there are “pastries”. A pastry has zero, one, or many allergens. Hence I’m using a list in Pastry with @OneToMany relation. Now, with this way of managing the relations, we get redundant entries, as for each pastry a new entry with the same allergen is created: Our current solu…
Update query not working in preparedStatements Java
I am writing this program in which I am using preparedStatements to make changes to an SQL Database. However, the UPDATE query is not working. Here is the code: The problem is that no error is being thrown, that is, the output is always Successfully Updated. However, the changes are not being reflected on the…
Spring Find by unique properties
Given 1 relational table Doctor_ID Client_ID 2 2 2 3 2 4 3 5 4 2 4 3 And I want all the occurrences where client_id is not equals to 3, ignoring the same doctor_id. In this example, I would only get the 4th row… Doctor_ID Client_ID 3 5 How could I achieve something like that? Answer This query with
Problem in running application with Vaadin and Spring (MySQL DB)
I am trying to connect a Vaadin project to a MySQL database following the instructions I found here: https://dzone.com/articles/how-to-connect-a-mysql-database-to-a-vaadin-applic I downloaded the ready project in the article (also available here: https://github.com/Liskokuningas/databasemysqlexample) I, then,…
K8s Spring Application cannot connect to Mysql DB
I wanted to try and deploy my spring boot application on kubernetes. I setted up a test environment with microk8s (dns,storage,ingress enabled) which consists of a pod running the application itself and a pod with the MySQL database. Each pod has its own service and is running on the same default namespace. T…
Java.net.ConnectException: Connection refused on Docker + Keycloak
I’m new to Docker and I’m having a hard time connecting Keycloak to my local MySQL database. Does anyone have a hint of what’s going on? This is my Dockerfile: The error log shows: Steps already taken: Disabled Firewall; Added bind-address: 0.0.0.0 to my my.cnf file; root@% already has all p…