Hibernate version: 2.1
I've got a bottom-up situation (I've inherited a database schema that I cannot change) and am wondering how much flexibility I have in my mapping documents when I indicate something like:
Code:
<property
name="applyShipping"
type="java.lang.Integer"
column="ApplyShipping"
/>
and the underlying MySQL column is something like:
Code:
`ApplyShipping` SMALLINT UNSIGNED,
Better put, what is the mechanism that determines how the underlying SQL column is converted to the Integer type indicated above? Presumably I can't just specifiy *anything* for the hibernate type, it must have to conform to the underlying SQL columh type somehow.
So I guess my questions are:
* How does Hibernate convert between the types indicated in the mapping file and the underling SQL column types?
* What kind of flexibility do I have here? Can I take that MySQL SMALLINT and map it to an java.lang.Integer? For "reads" this should not be a problem (a mysql smallint fits inside a java.lang.Integer) but what happens during "writes" (when the Integer contains more data than will fit within the smallint)?
* Is there a document that lists the Hibernate types, the corresponding Mysql types, and the conversion behavior?
For direct JDBC use, this document (among others) answers these questions:
[url]
http://java.sun.com/j2se/1.3/docs/guide ... ml#1053867[/url]
Does a similar document exist for Hibernate. Or perhaps Hibernate is simply using JDBC and the type mappings defined in the JDBC docs are what I should reference?
Thanks much,
- Gary[/code]