-
Mar 3rd, 2012, 09:47 AM
#1
How to fix this : org/springframework/dao/DuplicateKeyException
Hi,i am trying to update records in DataBase using spring batch
I have customReader and customWriter classes to read and write to databse
when i run job i am able to read from database but while updating the records
I am getting following exception:
java.lang.NoClassDefFoundError: org/springframework/dao/DuplicateKeyException
My Update method is as follows :
public void update(String col,String val){
System.out.println("IN update method");
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("applicationDB.xml" );
DataSource dataSource = (DataSource) appContext.getBean("dataSource");
String sql="update person set fname = ? where fname = ? ";
jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.update(
sql,
new Object[] {col, val}
);
}
-
Mar 6th, 2012, 04:23 AM
#2
The jar containing class DuplicateKeyException is missing from your class path.
Include the jar in your class path and try to run again.
-
Nov 26th, 2012, 02:51 AM
#3
sorry for replying late....my problem solved, it was due to mistake in query i wrote..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules