Sunil Tiwari wrote:1) How can SQL Antipatterns help in MVC architecture?
I do have a chapter titled
Magic Beans in my book, about the MVC architecture. The MVC antipattern I see most commonly is for application development frameworks such as Ruby on Rails (and its imitators) to simplify MVC by making the Model an instance of the
Active Record data access component. Martin Fowler describes Active Record (
http://martinfowler.com/eaaCatalog/activeRecord.html), but he also describes several other data access patterns. Unfortunately, frameworks that try to simplify application development push the idea that all you need is Active Record. Of course most applications in the real world are more complex, and you have to encapsulate that complexity somewhere. So users of these frameworks end up putting a lot of their domain logic into their Controller classes, which leads to fat controllers, code duplication, and difficulty in unit testing.
Sunil Tiwari wrote:2) What are the common pitfalls in DB application development, using Java?
I have standard advice for Java developers:
90% of the issues you will face are related to your CLASSPATH.Of the remaining problems that are not due to CLASSPATH, 90% of those are related to your classloader.
This is kind of a glib answer, but I think it's not far from being true. In Java, the biggest hurdle that faces every developer (edit: every developer who uses JDBC, that is) is to try to understand how to load a JDBC driver and get a connection to the database. It's probably the first time a Java developer uses the reflection API (perhaps the
only time).
This isn't the most advanced or complex issue, but it's the most common one, because every developer has to learn to connect to the database first, before doing anything further. And let's face it, there's quite a steep learning curve to understanding the steps of connecting to a database.