• 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

ArrayList to Table

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to move my data from an ArrayList into a Table.  This is specific to a derby type database.  I am recieving  Embedded Statements cannot be cast to java.util.collections. I cannot see any other way to get the array into the table
I have looked through the posts in the JDBC forum and I have not seen anything similar to my problem.  I am new to JDBC, all of my database history strictly involves SQL.  I have not noticed any code in this forum which makes me hesitant to post any. If anyone can help I would be grateful thank you
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cherokee Nelson wrote:I have looked through the posts in the JDBC forum and I have not seen anything similar to my problem.


And what about this topic?
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What data is in your ArrayList?
What does the code that is causing you issues look like?

If it's a List<SomeClass> where SomeClass is a representation of a row in a table, then loop over the array and do a batch insert.
If you are SELECTing from the table then build an instance of SomeClass for each row, adding it to a List.

Roel:  That link is about PL-SQL, which is a different beast in so many ways.  In that you would define a couple of TYPEs (one for the object, one for a table of that object) and then declare the procedure/function as taking the table TYPE.
That won't work for SQL.
reply
    Bookmark Topic Watch Topic
  • New Topic