Hello everyone,
I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties resource="database.properties"/>
<classPathEntry location="${driver.path}"/>
<context id="ODDloot" targetRuntime="MyBatis3">
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
<property name="userId" value="${database.username}"/>
<property name="password" value="${database.password}"/>
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<table schema="BASE" tableName="SERVER">
<property name="useActualColumnNames" value="true"/>
</table>
</context>
</generatorConfiguration>
It's basically set up just like the example given here:
http://www.mybatis.org/generator/configreference/xmlconfig.html
However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:
And this is what I get as a result:
<properties> resource database.properties does not exist
The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.
Here is what I already tried:
- Specifying the classpath via -cp
- Using full and relative paths in the configuration file to point to the property file
- Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.
Any idea what I might be missing or doing wrong? Any help greatly appreciated.
Cheers,
Carsten