Hi,

I'm using OJB and I want to save a result set to file, then recreate it at
a later time. I want to do something like the following:

Collection result = broker.getCollectionByQuery(query);
File file = new File(filename);
OutputStream out = new FileOutputStream(file);
MySerializer ser = new MySerializer();
ser.serialize(out, result);
out.close();

(here the user can pause from minutes to several days/weeks)

Then at a later point in time I want to recreate the collection from the
file.

File file = new File(filename);
InputStream in = new FileInputStream(file);
MySerializer ser = new MySerializer();
Collection result = ser.unserialize(in);
in.close();

Iterator itor = result.iterator();
while(itor.hasNext())
    System.out.println(itor.next());

BUT, I do not want to serialize the whole object(s). I just want to write
the primary key of each object in the result set to the file.

Before I start to re-invent the wheel (which I have done many times), is
there something similar already?
If not, how do I get hold of each primary key in a collection in an
efficient way (without materializing each object)?
Somewhere in the back of my head I heard of a java standard for
"disconnected result sets". Is that something I should dig deeper into?

/Goran Ehrsson



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to