How to JSON serialize sets?

I have a Python set that contains objects with __hash__ and __eq__ methods in order to make certain no duplicates are included in the collection. I need to json encode this result set, but passing even an empty set to the json.dumps method raises a TypeError. File “/usr/lib/python2.7/json/encoder.py”, line 201, in encode chunks = self.iterencode(o, … Read more

When and why JPA entities should implement the Serializable interface?

The question is in the title. Below I just described some of my thoughts and findings. When I had a very simple domain model (3 tables without any relations), all my entities did NOT implement the Serializable interface. But when the domain model became more complex, I got a RuntimeException, saying that one of my … Read more

Converting Stream to String and back…what are we missing?

I want to serialize objects to strings, and back. We use protobuf-net to turn an object into a Stream and back, successfully. However, Stream to string and back… not so successful. After going through StreamToString and StringToStream, the new Streamisn’t deserialized by protobuf-net; it raises an Arithmetic Operation resulted in an Overflow exception. If we … Read more