Serializable issues about resultset objects
I want to implement a CS application using Sockets. Th开发者_如何学Pythone db query result are of different classes and I don't mean to put those methods handling the result in the server end, I just want the server dealing with db queries, so I decide to pass the resultset through networks. But resultset is not serializable. I wonder whether there are any proper approaches handling this?
It sounds like what you want to use is DTO's (I've heard it defined as both Data Transfer Object and Domain Transfer Object, but the idea is the same). You don't want to pass the actual resultset, all you care about is the data contained in the resultset, so you define classes that represent your data, and return a collection of instances of those classes, not the resultset itself.
精彩评论