I'm running Middlegen (v2.1) against Microsoft SQLServer. Middlegen connects fine, but says it can't find any tables. When I run the Middlegen IDE in RAD, it even lists all the tables I need, but when I select one (or several) and hit "Run," it says it can't find any tables in the database. It's sending the following SQL to the database:
Code:
exec []..sp_tables NULL, N'', N'', NULL
The DB complains of a syntax error. I've tried using JTDS and Microsoft's JDBC driver and got the same error both times. It seems that including the database name in the brackets solves the syntax error:
Code:
exec [MY_DB]..sp_tables NULL, N'', N'', NULL
However, it still returns an empty result set. The SQL should actually be:
Code:
exec [MY_DB]..sp_tables NULL, NULL, NULL, NULL
I've tried specifying the DB in the URL or leaving it out, I've tried specifying or leaving out the schema and catalog in the Ant task, I've tried specifying or leaving out tables, I've tried logging in as a different user, and I've tried all combinations of the above.
Here's my basic Ant script:
Code:
<project name="Middlegen Test" default="all" basedir=".">
<path id="classes">
<fileset dir="..">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="middlegen" classname="middlegen.MiddlegenTask" classpathref="classes"/>
<target name="init">
<tstamp/>
</target>
<target name="all" depends="init, create-mapping"/>
<target name="create-mapping">
<middlegen
appname="middlegen-test"
prefsdir=".middlegen"
gui="true"
username="MY_USER"
password="MY_PASSWORD"
databaseurl="jdbc:jtds:sqlserver://MY_SERVER:MY_PORT/MY_DB"
driver="net.sourceforge.jtds.jdbc.Driver">
<!-- Plugins -->
<hibernate
destination="."
package="test.hibernate"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
genXDocletTags="true"/>
</middlegen>
</target>
</project>
Any ideas?