Storing a column containing a JSON-object before save

Hugi Thordarson <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi all,
I've got a text column containing an object (or rather; an object structure) that's been serialized to a JSON string. I'm currently just re-serializing every time I change something—not very nice— so I'd like to do something…nicer. I.e. preferably, cayenne would know that something within the structure has changed, and take care of re-serializing for me (or let me know I need to re-serialize before commit).
I could re-serialize everything before every commit, but for performance reasons I'd prefer to perform re-serialization only if the structure has actually changed.

First thought was creating a custom ValueObjectType and just model the type directly, but it seems like a bit of an overkill. Or perhaps it's not?

Grateful for any suggestions.

Cheers,
- hugi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.