1 Reply Latest reply: Sep 7, 2012 9:29 AM by greybird RSS

    Achieving tuple binding in case of non-zero argument constructors

    user730201
      How to create tuple binding for the following case,

      class A {

           int i1;
      B b1;
           X x1;
      }

      class B {
      long[] j1;
      Y y1;     
      }

      Instances of class A are stored in BDB and member i1 of A acts as a key.

      Now, I want control the serialization by serializing only the first two members of class A and first member of class B. Class A holds a reference of an instance of class B. Instances of classes X & Y are dynamically computed and must not be serialized. Also classes, A and B do not have default constructors and both these are part of an existing application.

      Default java serialization leads to unnecessary space wastage. How can I use tuple binding or any other mechanism provided by BDB to effectively serialize classes, A & B with the help of class catalog.
        • 1. Re: Achieving tuple binding in case of non-zero argument constructors
          greybird
          With a TupleBinding, you explicitly write code to serialize each field. So your code would simply not serialize the fields that you don't wish to be stored.

          With a SerialBinding, which uses Java serialization, you would need to add the Java 'transient' keyword to the declaration of the fields that you don't wish to serialize.

          --mark