Support for storing large strings as multiple attribute/value pairs #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am using SimpleJPA as persistence framework to access SimpleDB and found this piece of software very helpful.
I have recently added support for storing strings larger than 1024k by transparently splitting the string across multiple attribute value pairs in SimpleDB.
In my webapplication there is a form where users normally enter short strings but are allowed to enter longer texts as well. I can now transparently store these strings in a single property without the need to persist the property in S3.
I would like to contribute my changes to the SimpleJPA project. You can find details below. What do you think?
Details:
I have modified the Save-operation such that strings being larger than 1024k in UTF-8 are splitted into several chunks. Each chunk contains upto 1020k of data. Appended to the data is a counter which persists the order of chunks. Special care is taken not to split special characters which need more than one byte in UTF-8 encoding.
I have modified the ObjectBuilder accordingly: If there are multiple values for an attribute, the counter is retrieved and the values are concatenated in the correct order.
There is a new class for testing.