• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList to Table

 
Cherokee Nelson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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?
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic