• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting a 'BatchUpdateException' error message

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting a 'BatchUpdateException' error message returned by my code for updating several related tables, here's part of the stack trace:

java.sql.BatchUpdateException: Unknown column 'id' in 'field list'
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2020)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1451)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)

and here's the code that's causing the error:


Here's part of the code for the 'RefitemToAuthor' class:



And here's part of the code for the 'RefitemToAuthorID' class:




 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ava.sql.BatchUpdateException: Unknown column 'id' in 'field list'


How you map the columns to fields in the DB? Specifically Author, Referenceitem mappings etc...?
 
Vance Arocho
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To resolve that error, I created 2 classes, 'RefitemToAuthor.java' and 'RefitemToAuthorID.java'. ''RefitemToAuthorID.java' has instance variables representing the different parts of the composite primary key. And 'RefitemToAuthor.java' has a 'RefitemToAuthorID' instance variable and associated 'get' method with the '@Id' annotation. 'RefitemToAuthor.java' also has '@Entity' and '@Table' annotations.
 
reply
    Bookmark Topic Watch Topic
  • New Topic