Reggie, You have an ArrayList or what? Different resultsets? References to something?
If you had DTO (data transfer objects), it would make sense to clone the object. If they are really database objects, you have to make the copy yourslef and change the fields before adding it. An O/R framework would also be useful in abstracting the database code.
Reg, Using pure JDBC: 1) Read row from table into data structure 2) Create new row with that data (and different primary key)
As I said earlier, I think you would benefit from using an O/R framework. You are already thinking at a higher level of abstraction (thinking about cloning rather than copying rows) so it may be easier to work with objects.
Do you mean that you want to insert the same row, a second time? In other words, you want the same row to appear twice in the same table? You are aware, I assume, that you won't be able to do this if there is a unique index (or primary key) defined for the particular table, aren't you?
Or do you want to copy a row from one table to another?
In either case, you can do this via SQL alone. Most databases support something like:
So no need for data structures in java. (Or am I missing something?)