JPA or JDBC, how are they different?

后端 未结 4 1658
青春惊慌失措
青春惊慌失措 2020-11-29 14:56

I am learning Java EE and I downloaded the eclipse with glassfish for the same. I saw some examples and also read the Oracle docs to know all about Java EE 5. Connecting to

4条回答
  •  独厮守ぢ
    2020-11-29 15:19

    JDBC is the predecessor of JPA.

    JDBC is a bridge between the Java world and the databases world. In JDBC you need to expose all dirty details needed for CRUD operations, such as table names, column names, while in JPA (which is using JDBC underneath), you also specify those details of database metadata, but with the use of Java annotations.

    So JPA creates update queries for you and manages the entities that you looked up or created/updated (it does more as well).

    If you want to do JPA without a Java EE container, then Spring and its libraries may be used with the very same Java annotations.

提交回复
热议问题