Generally JDBC is preferred over entity beans due to performance considerations. Though Entity beans have advantages because of their component architecture and other features like security management, transaction management etc but while retrieving huge amount of data from database performance is poor compared to JDBC API calls. To get EJB architecture to some extent you can wrap JDBC with session beans. When it comes to choosing between entity beans versus JDBC calls, you can decide depending on quantity of data. For example, if you search data that retrieves 50000 records, JDBC is a better choice as compared to entity beans. Entity beans are not a problem with small data and you can even increase performance by some techniques like pooling etc, so use JDBC with session beans when you deal with huge data to improve performance.
How to decide when to use Entity Bean or Simple JDBC API
- Parent Category: Java EE Tips