In order to change this mapping by default (i.e. not via the columnOverrideelement), the only way we have used so far is to override the Java type resolver.
Second question I would like to access other column properties that cannot be found in JDBC, such as UNSIGNED columns. Is this even possible, using the IntrospectedColumn ? For example I noticed that the MyBatis generator do not map the correct java types for unsigned types. Am I missing something ?
Byte is a number (public final class Byte extends Number ...).
Different databases have different ideas about this. (For example,
Oracle recommends byte or short). It's mapped this way in the
generator because MyBatis maps TINYINT to Byte by default.
MySQL's unsigned numbers are completely non-standard. I'm not sure if
there is a way to get that information from the DatabaseMetaData or
not. You'll probably need to do a manual columnOverride for those. I
have a page in the help about dealing with MySQL unsigned types, but
it basically says "do a manual columnOverride". :)
I've had the idea of providing some customization to the type resolver
so you could do an override of the default mappings through the config
file, but have never implemented it. Maybe now's a good time for
that.
On Fri, Oct 12, 2012 at 12:45 PM, Brice Dutheil <brice.duth...@gmail.com> wrote:
> Hi,
> First of thanks for this product :)
> The first question is about TINYINT, the default resolver register
> java.lang.Byte for TINYINT, as seen in the following snippet
> typeMap.put(Types.TINYINT, new JdbcTypeInformation("TINYINT",
> //$NON-NLS-1$
> new FullyQualifiedJavaType(Byte.class.getName())));
> As we are using it in our codebase, and as described on the MySQL doc,
> shouldn't it be a number such as a Short.
> http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-con... > I understand that Byte and TINYINT do have the same size, however we would
> prefer it as a number.
> In order to change this mapping by default (i.e. not via the columnOverride
> element), the only way we have used so far is to override the Java type
> resolver.
> Second question I would like to access other column properties that cannot
> be found in JDBC, such as UNSIGNED columns. Is this even possible, using the
> IntrospectedColumn ?
> For example I noticed that the MyBatis generator do not map the correct java
> types for unsigned types. Am I missing something ?
On Friday, October 12, 2012 2:15:15 PM UTC-4, Jeff Butler wrote:
> I've had the idea of providing some customization to the type resolver > so you could do an override of the default mappings through the config > file, but have never implemented it. Maybe now's a good time for > that.
On Monday, October 15, 2012 5:10:37 PM UTC+2, Paul Krause wrote:
> On Friday, October 12, 2012 2:15:15 PM UTC-4, Jeff Butler wrote:
>> I've had the idea of providing some customization to the type resolver >> so you could do an override of the default mappings through the config >> file, but have never implemented it. Maybe now's a good time for >> that.