4 Replies Latest reply on Oct 30, 2009 9:58 PM by SunilAdobe

    Saving Custom Objects to database

    flairjax Level 1

      So stil having issues saving a custom object "data:Mydataclass to a SQLite3 database.   I have tried JSONEncode, JSON.encode, IExternalizable, bytearray.writeObject, bytearray.readObject, and registerClassAlias.  I can save items correctly, but when getting them back from the database they are of course either a generic Object or the correct object type Mydataclass, but all its internal properties, which can be lists of other custom objects are nulled out.

       

      I am using an httpservice request to send to a rails app and using rails rest resouce to pull it back.

       

      Beta needs to go out and I am stuck.  I have 4 hours and counting.

       

      J

        • 1. Re: Saving Custom Objects to database
          mewk Level 3

          j,

           

          it sounds like you're hitting a similar problem to what i posted about earlier. have you tried returning json encoded data from rails? -- (make sure there are no NULL values...). i was able to pass json objects, which were fairly complex, back and forth btw php and flex w/o too much trouble.

           

          check out the post and if that doesn't help you should probably repost again with some example failures. the dcd is still buggy and the adobe team needs all the feedback they can get. thanks,

           

          - e

          • 2. Re: Saving Custom Objects to database
            flairjax Level 1

            Can't even encode via JSONEncoder or JSON.encode.  I get a stack overflow error: at com.adobe.serialization.json::JSONEncoder/objectToString()

             

            Who would guess this would be so difficult.

            • 3. Re: Saving Custom Objects to database
              mewk Level 3

              ok j,

               

              i just created a new project to test json encoding and it's working for me. FB beta 2 looks like it no longer comes with the com.adobe.serializer library, so I grabbed a swc file from here. The object i encoded against is arguably pretty simple -- it reduces down to arrays, ints, and strings -- but, as you can see, the encoding is successful.

               

              you should try the new swc, and if it doesn't work, you should pick your object apart to find out which data types the serializer is choking on. the json swc does come with source files, so if the encoder fails you might be able to tinker around and get it to work as you need. hope this helps,

               

              - e

              • 4. Re: Saving Custom Objects to database
                SunilAdobe Adobe Employee

                Beta 2 has the serializers.swc, but that gets added only if you use the DCD workflows to create your service. Ofcourse you can add it manually if you want to, it should be under the dcrad plugin inside the directory dcradSwcs.

                 

                Thanks

                -Sunil