Exception: Org.springframework.orm.hibernate3.HibernateJdbcException

Source: Internet
Author: User

. Springframework.orm.hibernate3.HibernateJdbcException:JDBC exception on Hibernate data access:sqlexception for SQL [ Insert into Tb_news (N_title, N_content, N_style, N_addtime, N_addadmin, N_ispublish, N_publishtime, N_publishadmin, n_up DateTime, N_updateadmin, N_location, N_isshield, N_shieldtime, N_shieldreason, N_shieldadmin, N_deleteadmin, N_ Deletetime, N_clicknum, N_url, N_isdelete, t_id, n_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?, ?)]; SQL state [72000]; Error code [1461]; Could not execute JDBC batch update; Nested exception is org.hibernate.QueryTimeoutException:Could not execute JDBC batch update

Org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException ( sessionfactoryutils.java:645)

Org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException ( hibernatetransactionmanager.java:793)

The problem occurs because the UPDATE statement cannot be executed.

Possible situation

1 The length of the database field is limited, when the data length exceeds the length of the data, the test method can add a try catch block in the access method, and you can see the cause of the exception clearly

2 fields that are not empty in the database are inserted into empty fields. Carefully check that the parameters passed from the page are accepted correctly and that the data that was inserted violates the database field constraints

All exceptions appear as follows:

Org.springframework.orm.hibernate3.HibernateJdbcException:JDBC exception on Hibernate data access; Nested exception is org.hibernate.exception.GenericJDBCException:Could not execute JDBC batch update

JDBC generates an exception that occurs when I modify my data and then save it.

Situation Description:

Occurs when I modify the data and invoke Spring's gethibernatetemplate (). Merge (person); It's changed. Update (person); (The difference between the update () and the merge () method is not quite clear)

Problem solving:

May be my stupid relationship, I put the cache clean, have restarted the next server, and with a breakpoint always with the code, the result is gone, nothing unusual. I am happy, but still do not know how can happen such a mistake, depressed.

Correction: Cause this exception is not because of caching and breakpoints, the reason why did not delete the above conclusions to remind yourself to encounter problems to think, don't old silly pull the fantasy.

In fact, the cause of the problem is very simple, I set up the database when the personname to not NULL, which I accidentally did, but I was in the foreground when the value of the change did not pass the time (in fact, with the merge () can not be transmitted, But do not know why is not the PersonName pass this one time, so caused the above error, when I add <input type= "hidden" value= "Personso.personname" Name= "<WW: The property value= ' Personso.personname '/> ' was passed, but it's strange that if you use the merge (), you don't have to pass the value of the database again, but you need to figure it out.

Author: csdn Blog tfy1332

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.