Subject | Re: Data Type Mappings |
---|---|
Author | kkras2000 |
Post date | 2002-06-07T19:37:11Z |
Thank you for the explanation Roman.
Regards
Kris
Regards
Kris
--- In Firebird-Java@y..., "rrokytskyy" <rrokytskyy@y...> wrote:
> Hi,
>
> > When reading a byte[] from the BLOB field can I do the reverse
i.e.
> > stmt = conn.prepareStatement(queryString);
> > rs = stmt.executeQuery();
> > if (rs.next()) {
> > serializedObject = (SerializedObject) rs.getObject
> (colIndex);
> > }
>
> No, this will not work. You will get ClassCastException, we do not
> deserialize objects. :)
>
> > or do I have to do the following?
> > stmt = conn.prepareStatement(queryString);
> > rs = stmt.executeQuery();
> > if (rs.next()) {
> > ObjectInputStream in = new ObjectInputStream(
> > new ByteArrayInputStream(rs.getBytes(1)));
> > serializedObject = (SerializedObject) in.readObject();
> > }
>
> This is the correct approach.
>
> Best regards,
> Roman