<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to type-mapping</title><link>https://sourceforge.net/p/dal4j/wiki/type-mapping/</link><description>Recent changes to type-mapping</description><atom:link href="https://sourceforge.net/p/dal4j/wiki/type-mapping/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 12 Sep 2012 01:33:06 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/dal4j/wiki/type-mapping/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage type-mapping modified by Harry Gardner</title><link>https://sourceforge.net/p/dal4j/wiki/type-mapping/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,8 +1,4 @@
-There are a default set of database to java type mappings supported by DAL4j.
-To add additional types or over-ride how a database type is mappped, the
-XML configuration file used to drive code generation can be modified. To
-define custom type mappings, add the following to the XML configuration file
-between &lt;entityBeanGenConfig&gt; ... &lt;/entityBeanGenConfig&gt;.
+There are a default set of database to java type mappings supported by DAL4j. To add additional types or over-ride how a database type is mappped, the XML configuration file used to drive code generation can be modified. To define custom type mappings, add the following to the XML configuration file between &lt;entityBeanGenConfig&gt; ... &lt;/entityBeanGenConfig&gt;.
 
   &lt;entityBeanGenConfig&gt;
 
@@ -23,10 +19,7 @@
 
   &lt;/entityBeanGenConfig&gt;
 
-If a database type with a specific size should have a mapping defined, define 
-it as: db_type(X). Note that type mappings by size of a defined column are 
-always resolved before type mappings w/out a size specified. So, it is 
-possible to have tinyint(1) and tinyint mappings defined.
+If a database type with a specific size should have a mapping defined, define it as: db_type(X). Note that type mappings by size of a defined column are always resolved before type mappings w/out a size specified. So, it is possible to have tinyint(1) and tinyint mappings defined.
 
 Here is an example to map tinyint(1) to a boolean and tinyint to Byte
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Gardner</dc:creator><pubDate>Wed, 12 Sep 2012 01:33:06 -0000</pubDate><guid>https://sourceforge.net65f55125885c8af19769d066b286f41fdfb0055d</guid></item><item><title>WikiPage type-mapping modified by Harry Gardner</title><link>https://sourceforge.net/p/dal4j/wiki/type-mapping/</link><description>There are a default set of database to java type mappings supported by DAL4j.
To add additional types or over-ride how a database type is mappped, the
XML configuration file used to drive code generation can be modified. To
define custom type mappings, add the following to the XML configuration file
between &lt;entityBeanGenConfig&gt; ... &lt;/entityBeanGenConfig&gt;.

  &lt;entityBeanGenConfig&gt;

  ...

     &lt;types&gt;
        &lt;type&gt;
           &lt;databaseType&gt;some_db_type&lt;/databaseType&gt;
           &lt;javaType&gt;SomeJavaTypeWhichInheritsFromObject&lt;/javaType&gt;
        &lt;/type&gt;
        &lt;type&gt;
           &lt;databaseType&gt;some_db_type2&lt;/databaseType&gt;
           &lt;javaType&gt;SomeJavaTypeWhichInheritsFromObject&lt;/javaType&gt;
        &lt;/type&gt;
     &lt;/types&gt;

  ...

  &lt;/entityBeanGenConfig&gt;

If a database type with a specific size should have a mapping defined, define 
it as: db_type(X). Note that type mappings by size of a defined column are 
always resolved before type mappings w/out a size specified. So, it is 
possible to have tinyint(1) and tinyint mappings defined.

Here is an example to map tinyint(1) to a boolean and tinyint to Byte

     &lt;types&gt;
        &lt;type&gt;
           &lt;databaseType&gt;tinyint(1)&lt;/databaseType&gt;
           &lt;javaType&gt;Boolean&lt;/javaType&gt;
        &lt;/type&gt;
        &lt;type&gt;
           &lt;databaseType&gt;tinyint&lt;/databaseType&gt;
           &lt;javaType&gt;Byte&lt;/javaType&gt;
        &lt;/type&gt;
     &lt;/types&gt;

NOTE: The tinyint type mappings above are supported by default.

The default type mappings supported by DAL4j are:

      DB_TYPE -&gt; JavaTypeWhichInheritsFromObject

      "varchar" -&gt; "String"
      "char" -&gt; "String"
      "varchar2" -&gt; "String"
      "text" -&gt; "String"
      "int" -&gt; "Integer"
      "int identity" -&gt; "Integer"
      "smallint" -&gt; "Integer"
      "number" -&gt; "Integer"
      "tinyint" -&gt; "Byte"
      "tinyint(1)" -&gt; "Boolean"
      "bit" -&gt; "Boolean"
      "bigint" -&gt; "Long"
      "bigint identity" -&gt; "Long"
      "datetime" -&gt; "Date"
      "date" -&gt; "Date"
      "Time" -&gt; "Date"
      "smalldatetime" -&gt; "Date"
      "timestamp" -&gt; "Date"
      "float" -&gt; "Float"
      "double" -&gt; "Double"
      "decimal" -&gt; "Double"
      "image" -&gt; "byte []"
      "blob" -&gt; "byte []"</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Gardner</dc:creator><pubDate>Wed, 12 Sep 2012 01:31:55 -0000</pubDate><guid>https://sourceforge.neta6a203eaf1e3f9843e578be7cf514ef787e57889</guid></item></channel></rss>