I’m coding on a java Swing sql project. I’m stuck at deleting and updating an information record. I can add a new record normally but can’t update or delete one. When I delete, it will notify ‘can’t …
Tag: java
Recursive Iterator for a single table
I have a table in which the foreign key refers to the id of the same table. I need to find the children of the first element that pass me as a parameter, until I reach a certain level. I need to find …
Spring Data Insert Data when entry not yet exists
SCENARIO: I have a MySQL Database where I have one Table with a Mapping of a user and a product. My Application offers an api so I have to be aware that the mapping will not be done multiple times. Therefor I want to check if the two ids( of the user and the product) are already mapped. PROBLEM: I
How to get SQL prepared statement based on user input (scanner)
I have difficulties with creating prepared statement which SELECT and print out rows which fulfill condition: SELECT ReservationStartDate, ReservationEndDate FROM treservations WHERE …
For JDBC prepared statements, how are the position of variables determined when an actual value is supplied in the SQL statement
If I have the following code, with one value supplied in the SQL statement, what would be the value of the position for GROUP? Is it 2 or 3? In other words, is the supplied value counted when …
Perform SQL statement after each DELETE
Is there a way to make jOOQ perform a SQL statement (in my case a CHECKPOINT) after each DELETE? Ideally there would also be a way to specify the tables that this happens for. The RDBMS I’m using (…
List DataModel reads just the last element
I have a database created with location updates and in the database there is a bunch of locations x and y. and in the second method readFirestore() reads the location data and compares the favorite …
Returning id in generic insert using JOOQ
I have a very generic API to insert stuff using JOOQ to soem tables: Is there a way to return id of that inserted record? All primary keys of tables in my db are named “id” so I could ahrdcode it but I cannot find a way to return it and cast to Integer / Long. I’m using JOOQ 3.9.5.
How to resolve ambiguous match when chaining generated Jooq classes
I have defined my models in JPA and am writing some queries for my application and I am using JOOQ generated classes to join all the tables together to check if the requested resources actually belong to the requesting user. However, when I do this I get the following warning: This is my code This is the SQL …
My custom order by in criteria query/jpql
Is it possible to do my custom order by using criteria query or jpql in Java? In my table, I have a column – number type(for now, this column includes numbers such as 1, 2, 3, 5, 10). I would like to sort result in this order 2, 5, 1, 10, 3. How can I do it? Answer You have