Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
about data types mapping
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brice Dutheil  
View profile  
 More options Oct 12 2012, 12:45 pm
From: Brice Dutheil <brice.duth...@gmail.com>
Date: Fri, 12 Oct 2012 09:45:45 -0700 (PDT)
Local: Fri, Oct 12 2012 12:45 pm
Subject: [mybatis-generator] about data types mapping

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 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 ?

-- Brice


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Butler  
View profile  
 More options Oct 12 2012, 2:15 pm
From: Jeff Butler <jeffgbut...@gmail.com>
Date: Fri, 12 Oct 2012 14:15:13 -0400
Local: Fri, Oct 12 2012 2:15 pm
Subject: Re: [mybatis-generator] about data types mapping
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.

Jeff Butler


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Krause  
View profile  
 More options Oct 15 2012, 11:10 am
From: Paul Krause <paulkraus...@alum.mit.edu>
Date: Mon, 15 Oct 2012 08:10:36 -0700 (PDT)
Local: Mon, Oct 15 2012 11:10 am
Subject: Re: [mybatis-generator] about data types mapping

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.

> Jeff Butler

Great idea!  I've wanted this for a while.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brice Dutheil  
View profile  
 More options Nov 6 2012, 3:18 pm
From: Brice Dutheil <brice.duth...@gmail.com>
Date: Tue, 6 Nov 2012 12:18:25 -0800 (PST)
Local: Tues, Nov 6 2012 3:18 pm
Subject: Re: [mybatis-generator] about data types mapping

I can only agree with that :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »