When I’m creating instances of domain objects from a ResultSet, should I convert Strings which are null to an empty String. Conversely, when writing to the database should empty Strings be converted to null Strings?
What’s best practise here? Or is it just dependent on the application?
Many thanks.
The empty string,
""is a string just as any other. To me it, storing""asNULLmakes as much sense as storing""as''and storing"abc"asNULL.So, keep things simple: Store
""as'', and store anullreference asNULL.To quote the MySQL reference manual: