Search code examples
javahibernatejakarta-eejpaopenjpa

Different mapping to database types with different JPA Implementations


I'm developing a Java EE Application that uses JPA to persist its data.

At first I used Hibernate as the JPA implementation, but later I switched to OpenJPA, because that's what the Weblogic Application Server here comes equipped with.

That didn't pose any problems, but it got me thinking:

Are there differences in the mapping from Java datatypes to the database specific datatypes for the various implementations of JPA? If yes what are they? Do I always have to think about these differences or are there any common pitfalls that are easy to avoid?


Solution

  • The JPA spec does not define the default mappings from Java type to JDBC type, as a result yes of course you have to think about this when designing your metadata. A good read of the spec would be recommended to see the concepts that it simply doesn't tackle.

    The JDO spec defines these default mappings FWIW, so this aspect of portability there is not a problem.