PersistenceException
waltc Jan 2, 2009 10:20 PMI am receiving a persistence exception, could not execute JDBC batch update. Here are the particulars.
I am using JBOSS AS 5.00 and Seam 2.1.1, both GA versions. I have a simple entity relationship
a reservation entity which has a from and to date field plus a foreign key (id) filed for the user doing the reservation and the server that is being reserved.I built the CRUD application for this with seam-gen and I am updating the to field of a reservation. The lists and displays look and work great, btw.
When looking deeper into the reason (and the stack trace) I see the following:
"javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update"
still further down...
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from='2008-12-15 00:00:00', server=1, to='2009-01-05 00:00:00', user=1 where id=' at line 1"
Looking back in the log I see the following:
2009-01-02 16:14:48,238 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-1) opening JDBC connection
2009-01-02 16:14:48,239 DEBUG [org.hibernate.SQL] (http-127.0.0.1-8080-1)
update
ServerReservations.reservations
set
from
=?,
server=?,
to=?,
user=?
where
id=?
2009-01-02 16:14:48,239 INFO [STDOUT] (http-127.0.0.1-8080-1) Hibernate:
update
ServerReservations.reservations
set
from
=?,
server=?,
to=?,
user=?
where
id=?
2009-01-02 16:14:48,243 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-1) Executing batch size: 1
2009-01-02 16:14:48,254 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-1) about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2009-01-02 16:14:48,254 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-1) skipping aggressive-release due to flush cycle
2009-01-02 16:14:48,255 DEBUG [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-1) Could not execute JDBC batch update [update ServerReservations.reservations set from=?, server=?, to=?, user=? where id=?]
java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from='2008-12-15 00:00:00', server=1, to='2009-01-05 00:00:00', user=1 where id=' at line 1
Why has it lost the id of the current row being updated? And, more importantly, what should I change to fix this and similar issues in the future?
Thanks,
Walt
I am using JBOSS AS 5.00 and Seam 2.1.1, both GA versions. I have a simple entity relationship
a reservation entity which has a from and to date field plus a foreign key (id) filed for the user doing the reservation and the server that is being reserved.I built the CRUD application for this with seam-gen and I am updating the to field of a reservation. The lists and displays look and work great, btw.
When looking deeper into the reason (and the stack trace) I see the following:
"javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update"
still further down...
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from='2008-12-15 00:00:00', server=1, to='2009-01-05 00:00:00', user=1 where id=' at line 1"
Looking back in the log I see the following:
2009-01-02 16:14:48,238 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-1) opening JDBC connection
2009-01-02 16:14:48,239 DEBUG [org.hibernate.SQL] (http-127.0.0.1-8080-1)
update
ServerReservations.reservations
set
from
=?,
server=?,
to=?,
user=?
where
id=?
2009-01-02 16:14:48,239 INFO [STDOUT] (http-127.0.0.1-8080-1) Hibernate:
update
ServerReservations.reservations
set
from
=?,
server=?,
to=?,
user=?
where
id=?
2009-01-02 16:14:48,243 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-1) Executing batch size: 1
2009-01-02 16:14:48,254 DEBUG [org.hibernate.jdbc.AbstractBatcher] (http-127.0.0.1-8080-1) about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2009-01-02 16:14:48,254 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-1) skipping aggressive-release due to flush cycle
2009-01-02 16:14:48,255 DEBUG [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-1) Could not execute JDBC batch update [update ServerReservations.reservations set from=?, server=?, to=?, user=? where id=?]
java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from='2008-12-15 00:00:00', server=1, to='2009-01-05 00:00:00', user=1 where id=' at line 1
Why has it lost the id of the current row being updated? And, more importantly, what should I change to fix this and similar issues in the future?
Thanks,
Walt