I managed to get an XML schema generated for the SQL Server database I'm 
working on:

<generator>
    <name>org.jooq.util.XMLGenerator</name>
    <database>
        <name>org.jooq.util.sqlserver.SQLServerDatabase</name>
        <inputCatalog>${jooq-codegen.my-database}</inputCatalog>
        <outputCatalog>mydb</outputCatalog>
        <inputSchema>dbo</inputSchema>
    </database>
    <target>
        <packageName>xxx</packageName>
        <directory>target/generated-sources/jooq</directory>
    </target>
</generator>



I then tried to read it in to generate some java classes:

<database>
    <name>org.jooq.util.xml.XMLDatabase</name>
    <properties>
        <property>
            <key>xml-file</key>
            
<value>${project.basedir}/src/xml-schemas/mydb/information_schema.xml</value>
        </property>
    </properties>
    <inputCatalog>mydb</inputCatalog>
    <outputCatalog>mydb</outputCatalog>
    <inputSchema>dbo</inputSchema>
    <includes>
        ^(A|B|C).*
    </includes>
    <excludes></excludes>
</database>
<generate>
    <deprecated>true</deprecated>
    <instanceFields>true</instanceFields>
    <immutablePojos>true</immutablePojos>
    <validationAnnotations>true</validationAnnotations>
    <globalCatalogReferences>false</globalCatalogReferences>
    <javaTimeTypes>true</javaTimeTypes>
</generate>
<target>
    <packageName>com.example.data.db.entities</packageName>
    <directory>target/generated-sources/jooq</directory>
</target>


And it generated!  Unfortunately, it looks like all the integer based 
fields are getting mapped to Object.

public class CountryCode implements Serializable {

    private static final long serialVersionUID = 2091889765;

    private final Object  Id;
    private final Object  CountryCode;
 ...



The generated information_schema.xml file has these columns defined as:

<column>
    <table_catalog>mydb</table_catalog>
    <table_schema>dbo</table_schema>
    <table_name>CountryCode</table_name>
    <column_name>Id</column_name>
    <data_type>int</data_type>
    <character_maximum_length>0</character_maximum_length>
    <numeric_precision>10</numeric_precision>
    <numeric_scale>0</numeric_scale>
    <ordinal_position>1</ordinal_position>
</column>
<column>
    <table_catalog>mydb</table_catalog>
    <table_schema>dbo</table_schema>
    <table_name>CountryCode</table_name>
    <column_name>CountryCode</column_name>
    <data_type>int</data_type>
    <character_maximum_length>0</character_maximum_length>
    <numeric_precision>10</numeric_precision>
    <numeric_scale>0</numeric_scale>
    <ordinal_position>2</ordinal_position>
</column>



What might be going on to cause it to fail to map back to integer?

-Daniel

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to