Alternative to JPA / Hibernate
Ours is a legacy application, we are migrating from desktop to JavaEE web based application. Since it is desktop application database triggers, functions and procedures are heavily used to do lots of important functionality. Some of our team members were proposing JPA to move trigger, function and procedure logic to Java code.
However, this approach has several drawbacks:
- Database-specific optimizations in triggers/procedures are lost
- Moving complex logic to Java can create performance issues
- Team needs to learn new paradigms while maintaining legacy code
Alternative approaches:
1. MyBatis
MyBatis provides a good middle ground - SQL mapping without the complexity of full ORM. You keep control of your SQL while getting object mapping.
2. jOOQ
For applications heavy on stored procedures, jOOQ provides excellent support for calling database procedures and functions.
3. Keep Stored Procedures
Sometimes the best solution is to keep what works. Use a lightweight JDBC wrapper to call your existing procedures.