Schandha Ravi wrote:I'm working on a Sample DAO pattern, where in my pattern should be able to insert any record into any table.
As soon as I hear words like "anything into anything" I always suspect that someone hasn't sufficiently defined their requirements.
And if, indeed, you do mean "insert
any record into
any table" (including, presumably, ones you haven't dreamt up yet), then I'd suggest that
Java is probably not the language you want to use.
However, if there is some "syntax" (ie, restrictions or rules) on what you want to be able to do, there are a few
patterns that you might be able to use, just a couple of which might be Abstract Factory or Bridge.
However, if this really is an "anything to anything" scenario, then I fear you're into the realms of reflection; and the solution is likely to be complex, slow, difficult to understand, and even more difficult to
test properly.
Winston