-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.exception.GenericJDBCException: Could not exec
PostPosted: Wed May 11, 2011 3:29 am 
Newbie

Joined: Sat May 07, 2011 2:16 am
Posts: 3
I have a simple java page in which I am trying to insert data into the DB. Following is the code for it -->


Code:
public void execute() throws JobExecutionException {
        
         Session session = null;
         try{   
        
         session = HibernateUtil.getSessionFactory().openSession();
         org.hibernate.Transaction tx = session.beginTransaction();
         java.util.List taskList = session.createQuery("from Task as t where t.frequency = 'W'").list();
         Iterator i = taskList.iterator();
         int len=taskList.size();
         System.out.println("test"+len);
         while(i.hasNext())
          {
            Task task=(Task)i.next();
            TaskUser tu= new TaskUser();
            System.out.println(task.getProcessOwner());
            tu.setUserId(task.getProcessOwner());

            System.out.println(task.getTaskId());
            tu.setTaskId(task.getTaskId());

            System.out.println(task.getDueDate());
            tu.setDueDate(task.getDueDate());

            System.out.println(task.getDurationDays());
            tu.setDurationDays(task.getDurationDays());

            System.out.println(task.getReportTO());
            tu.setReportingTo(task.getReportTO());
            
            tu.setScanned("Y");
            
            tu.setLevels(3);
            
            tu.setStatus(3);
            
            session.save(tu);
            
         }     
         tx.commit();
         } catch (Exception e) {
            System.out.println(e);
         } finally {
            session.flush();
            session.close();
            
         }
      }   


The code was working perfectly some time back but then now it is throwing the following error. --

Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Task_User_Rel (Usr_Id, Task_Id, Due_Date, Duration_Days, Status, Scanned, Path, Levels, Reporting_To, Document_Date, Task_User_Id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update

I have checked the CMT and bean class the properties match with the DB. Is there anything I need to take care of?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.