2 Replies Latest reply on Aug 18, 2003 2:00 PM by null null

    Serialising Java Objects

    null null Newbie

      At the moment we have a database that contains a large number of objects in a specific format. We've got a Rectangle class (in C++), which, when written to the database using ODBC writes out two big endian integers as an eight byte binary array (it's in a varbinary field).

      To duplicate this in Java, I was originally planning to use serialisation, but I realised that this doesn't work as planned. (as it serialises more data than I need)How should I implement this inside an object? Each object might contain extra information, but most of them are transient fields.

      I don't want to have to change the format, and I don't want ot have specify byte arrays in my EJBs, I'm happier with just objects if this is possible - how should I implement my objects to make sure they are serialised correctly. Should I use Externalisable, or should I use SQLData? Or do I have to simply implement BLOB (which I'm a bit loath to do as it's a fairly complex API)