Reputation: 53
Every JPA-Provider (at least hibernate, eclipselink and openjpa) gives the possibility to create the ddl-schema on the basis of the jpa entity classes. But every database management system has his own data types.
So how do the jpa-providers decide which sql datatype will be chosen. (I think it will be provider specific). Is there a Mapping like String->varchar(xx), boolean->tinyint
and so on. But then this mapping has to be exist for every database, right? Can anyone put me in the right direction please? I searched in the hibernate source-code but I did not find the right code snippets.
Thanks!
Upvotes: 5
Views: 1719
Reputation: 14373
then this mapping has to be exist for every database, right?
You are right. The same is specified in the Dialect which is being used in DB connections.
For whatever I have searched this information is encapsulated inside the dialect driver for the DB which you use and the same must contain the mapping of java types -> db types
.
Here you can see mapping in Constructor.
Upvotes: 1
Reputation: 180
For each DBMS hibernate maintains dialect. which is available in hibernateX.jar.
Upvotes: 0
Reputation: 16080
See the Dialect class and implementations thereof.
Cheers,
Upvotes: 0