I have a few very simple java beans I would like to save as a record in a database. (No problem for me to use jdbc to linearize or delinearize the objects.) My question: I thought I would have my bean implement Serializable or Externalizable and overwrite the readObject and writeObject methods to do database access.
What do I do about the ObjectOutputStream and ObjectInputStream objects these mthods must have as parameters? How can I connect a database connection and a stream of this sort? Seems like I would have to buffer linear data in a byte array buffer just to satisfy the signatures of these methods! This seems crazy and so I assume I am missing something obvious.
Is there any reason to use Serializable or Externalizable in this case? The Javasoft tutorial says a bean must implement these interfaces but surely that's not right, is it?
Help! Send a good code example, please!
Thanks,
Alan