persisting with json in Siena

75 views Asked by At

Anyone persisted use the JSON format in Sinea?

http://www.sienaproject.com/documentation-json.html

I need to persist collection fields where the collection is relatively small and contains only simple types like int, short, long, etc... Should I hack the field and make it String and write custom JSON code for each field? Should the property type become siena.Json instead of Collection?

I guess the ideal scenario would be a JSON annotation (w/max length) for the collection letting Sinea know to serialize and serialize automatically.

Can you recommend a good way to code for this now?

1

There are 1 answers

0
jcalfee314 On

Just use @Embedded on the collection and Siena will use JSON automatically.

See otherContacts example in : http://www.sienaproject.com/documentation-getting-started.html "2 fields contacts & otherContacts containing embedded data structures stored JSON serialized in the DB"