I am new to hibernate but I have been reading a fair bit about it. The problem I'm struggling with is understanding how different technologies "implement" the JPA standard. I am using annotations with hibernate by using the sessionFactory. If I were to use the entityManager instead and mapped it in persistense.xml, would I then have a hibernate implementation of JPA?
I see that there are different persistent engines such as TopLink and that you specify these to connect to your database in persistence.xml or hibernate in the hibernate.cfg.xml file.
what implementation would the following persistence.xml give us?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="hello-world" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<class>com.foo.Greeting</class>
<properties>
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/test"/>
<property name="toplink.jdbc.user" value="root"/>
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="toplink.jdbc.password" value=""/>
<property name="toplink.ddl-generation" value="drop-and-create-tables"/>
</properties>
</persistence-unit>
</persistence>
I would rather use the JPA specification if it's more portable but to connect to the database and map to the database it appears you need some kind of persistence engine such as hibernate or TopLink, can anyone help me understand the differences between these engines. I want my code to be portable so I was thinking if I use EJB3 instead of Hibernate it would give me this. Any help is appreciated.