If you've ever worked on an Enterprise project before, you will know that almost every Java application uses an ORM tool to map an external database. The advantages of mapping a database structure with Java objects are as follows:
- Database neutrality: Your code will not be database-specific, so you don't need to adapt your code to a specific database SQL syntax, which may vary between vendors.
- Developer friendly workflow: You don't need to write complex SQL structures to access your data – you simply need to refer to Java fields.
On the other hand, it's also true that, by writing native SQL statements, you can be truly aware of what your code is actually doing. Also, in most cases, you can achieve maximum performance benefits by writing direct SQL statements. For this reason, most ORM tools include an option...