I have a method to detect duplicate entry for a column: (I inject to jdbcTemplate correctly) But i got this exception in runtime: Answer We can use the queryForList() method of jdbcTemplate like this: Where results is a List<String>.
Tag: spring
Why does Spring’s JDBC Templates doesn’t use the tables default value
I have a table in MYSQL and I am using JDBC Templates to do an insert into that table. One of the columns has a default value, and I am not specifying it in the Map<String, Object> parameters map. I am getting an exception Column ‘colName’ cannot be null. Can anyone explain this please? Thanks *Edit: code * Answer You
Order By Date ASC with Spring Data
I try to make an application with Spring-Data-JPA on a table in order by ASC but it gives me an error: Invalid derived query! No property asc found for type java.util.Calendar Why ? List
How can I resolve “The cursor was not declared” from SQL Server
I am connecting to SQL Server via Spring in WebSphere. I have a piece of pretty simple dynamic SQL (below) that is throwing “The cursor was not declared.” One of the settings for the data source that seems relevant is the “select mode” is “cursor”. I’m not really sure what I need to do to resolve the error. edit The
BatchSqlUpdate – how to get auto generated keys
I am using spring BatchSqlUpdate to insert a set of rows. How do I get the auto generated keys for all of the rows inserted? When doing a single insert I get the keys like this – Thanks! Answer There is no provided solution for this using BatchSqlUpdate as far as I know, but you can always query the last
Insert with Hibernate native query does not work for java.util.Date
I am using Hibernate JPA and Spring with a Mysql database and I want to insert using a SQL statement like this: But after running it I get the following error: Could someone help me on this please? PS. I am aware of using hibernate in non-native way, but I need to use native way. I am also of insert