JDBCPropertySet

[email protected]
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <[email protected]>
Hello,

I have implemented the storage of Java Objects with the JDBCPropertySet.
It simply works by serialising the object and storing it in the DATA field.
So it works only with the Serializable objects...

Here is the code:


for the get method:

				case PropertySet.OBJECT:
					try {
						byte[] bs =
rs.getBytes(colData); 
						if (bs == null) {
							o = null;
						} else {	
							ByteArrayInputStream
is = new ByteArrayInputStream(bs);
							ObjectInputStream
ois = new ObjectInputStream(is);
							o =
ois.readObject();
						}
					} catch (Exception e) {
						throw new
PropertyImplementationException(e);
					}
					break;

for the setValues method

		case PropertySet.OBJECT:
			try {
				ByteArrayOutputStream os = new
ByteArrayOutputStream();
				ObjectOutputStream oos = new
ObjectOutputStream(os);
				oos.writeObject(value);
				oos.close();
				ps.setBytes(3, os.toByteArray());
			} catch (Exception e) {
				throw new
PropertyImplementationException(e);
			}
			break;


What do you think of it? Could the code could go in the CVS repository?
Any advices/comment are welcome


Joachim.



**** DISCLAIMER **** 
"This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation."



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.