DB Access Using JDO,Entity Bean,JDBC,DAO,or...?

DB Access Using JDO,Entity Bean,JDBC,DAO,or...? A MES project,which solution is best? And which is proved? Any advantege and disadvantege?Give me your advice please...
[181 byte] By [baofengmaila] at [2007-9-29 16:21:28]
# 1

Depends on your needs.

JDBC: gives you full control over what SQL to send to the database. You may send implementation specific constructs, call stored procedures and DDL, anything. The price you pay is that JDBC is really low level, you do a lot of coding to achieve what you want, with lots of opportunity for getting it wrong.

DAO: These are ordinarily just a wrapper around JDBC, used to collect all the SQL implementation details in one place, and thus making it easier to change. This approach gives you most of the benefits and drawbacks of JDBC, with the added benefit of containing the SQL details.

EntityBeans: This is mainly a persistence framework. You specify your classes and the relationships between them, and the framework implements storing and retrieving them from the database. Also offers declarative (no programming) security and transactions. Some drawbacks are that you need to run your EntityBeans in an EJB container; they need to conform to certain interfaces; the ability to define relations between them is limited; they don't really scale very well.

JDO: Also mostly a persistence mechanism. JDO is defined as a standard through the JCP mechanism (as are JDBC and EntityBeans). Does not have the same restictions as EntityBeans regarding implementing certain interfaces or running in a specific container.

Hibernate: Another persistence mechanism that has gained popularity recently due to its elegance and ease of use. Same advantages as JDO, and even fewer restictions. But Hibernate is not a standard.

joarea at 2007-7-15 14:37:57 > top of Java-index,Other Topics,Patterns & OO Design...