• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Mapping Types.

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I have this in my mapping file (hbm.xml):



the generated SQL is :



But I want SMALLINT and not int(11)

How do I specifically specify the SQL types that I want ? Hibernate generates "approximate" datatypes for both the SQL and Java sides which, to me, is quite annoying. I think I know best which datatype to use ... for example, I want a field in my Java class to be Integer and map it to SMALLINT in the DB.

Also, I tried finding on the net a "mapping table" ... something like this:
Java DataType - Hibernate Mapping Type - MySQL datatype
String - string - varchar
etc etc
...

But, surprisingly I could not find any. Those that I found were very vague ... they go something like



I need a more "precise" table..showing which exact type map to which.


DB : MySQL



Thank you.
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try using short.

 
reply
    Bookmark Topic Watch Topic
  • New Topic