---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
Making the Java dream come true.
---------------------------------------------------------------------------
----- Original Message -----
From: bruehlicke
To: [email protected]
Sent: Thursday, February 07, 2008 11:04 PM
Subject: Newbe: JAVA_OBJECT best type to store as ?
Any example out there for storing a java "Properties" object ?
1) What type shall the Table Column have ? BLOB ? CLOB ?
2) Any example of how to do this ?
My assumption until now is that I have to create a BLOB and serialize and
de-serialize the "Properties" object. The latest I found on this was from
Bernt http://www.mail-archive.com/[email protected]/msg06658.html.
So I just need confirmation on the Column type I should choose.
=================================
Go to this link
http://coolharbor.100free.com/demo_dB_Pool.htm
Ignore the fact that the code its for an Application server.
Its a POJO Application server so it runs normal Java applications
On that page you will find all the source, it was originally written for
Derby
The little demo lib source is there as well, it does everything from dB
pooling, to serialization (with example)
to something called POJO persistance, which has a different view on
Hibernate JPA way
Also transactions in plain old SQL... and lots of other stuff
And if you like... you can use the POJO server to put the application on a
network, or the web, or start it from a desktop.... or or or
The sample was written for embedded apps....
Enjoy...
=================================
You need to serialize the object. One way of doing it is like this:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(item);
oos.close(); ps.setBytes(1, bos.toByteArray());An vice versa
when you retrive the object
B-)