db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: Newbe: JAVA_OBJECT best type to store as ?
Date Fri, 08 Feb 2008 07:36:05 GMT

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: derby-user@db.apache.org
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/derby-user@db.apache.org/msg06658.html. 
So I just need confirmation on the Column type I should choose.

Go to this link

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 
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....


You need to serialize the object. One way of doing it is like this: 
ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
ObjectOutputStream oos = new ObjectOutputStream(bos); 
        oos.close();        ps.setBytes(1, bos.toByteArray());An vice versa 
when you retrive the object


View raw message