Skip to content
Advertisement

Tag: java

UPDATE with RETURNING: Not able to retrieve ResultSet

I’ve tested the following UPDATE-RETURNING statement in my PostgreSQL client, and it correctly updates and returns the updated rows. However, in Java, I’m not able to retrieve the ResultSet. statement.execute() and statement.getMoreResults() always return false and statement.getResultSet() returns null, always. Am I missing something here? Answer Well, I wasn’t really able to solve this properly. However, I ended up using

Implement batchMerge() in JOOQ

I need to “upsert” a List of items. If an item’s id and anotherId is already existing, other values should be replaced by the new item. If it’s not, item should be inserted as new record. I came across JOOQ’s batchMerge and I thought it is similar to “upsert”. Unfortunately there are few documentation on the internet since this is

Order by 2 columns with case

I have a query that searches for user in 2 colums firstUser and secondUser and orders them by first and last name: But this first orders the cases when user is at first user then it orders the case when user is secondUser. Is ther a way to order the whole data by first name and last name no matter

SQL query in Java with enum return error of Incorrect integer value:

I get this error massage: java.sql.SQLException: Incorrect integer value: ‘xACxEDx00x05~rx00… the query is working, but if I put the category name (Category.Electricity) its return error. I call it with statement.setObject(…) meybe this is wrong..? the main class: the enum class: the method: so what is the way to call the enum? thank you! Answer seems like your table is expecting

Advertisement