Discussion:
[Middlegen-user] can't find tables w/ MSSQL JDBC driver running airline sample
k***@keysolutions.com
2002-12-10 00:43:10 UTC
Permalink
Anyone see this msg before? I couldn't find it in the list archives.

file:J:/MiddleGen/samples/build.xml:140: middlegen.MiddlegenException:
Middlegen successfully connected to the database, but couldn't find
any tables.
Perhaps the specified schema or catalog is wrong? -Or maybe there
aren't any
tables in the database at all?

My config:
Ant 1.5.1
MiddleGen 2.0b1
JDK 1.4.1
MSSQL 2000 w/ latest JDBC driver

I ran "ant create-tables" successfully and I can see the tables in the
database. I also tried setting the schema to "dbo" since MSSQL seems
present tables with that as a prefix sometimes. I'm running this in
the
MiddleGen samples directory. I can also run hsqldb-gui w/o problems,
though
the tree looks a little weird (the first item is really tall and it's
blank).

I suppose I could punt and use one of the supported database drivers,
but the driver is
listed on the MiddleGen web page as untested, so I thought I'd be nice
and
try using it :-)

BTW, here's my mssqljdbc.xml file (goes in config\database). Feel
free to add it
to the distribution:
===============
<property name="database.script.file"
value="${src.dir}/sql/${name}-mssql.sql"/>
<property name="database.driver.file"
value="j:/win32app/mssql/java/lib/mssqlserver.jar"/>
<property name="database.driver.classpath"
value="j:/win32app/mssql/java/lib/mssqlserver.jar;j:/win32app/mssql/java/lib/msbase.jar;j:/win32app/mssql/java/lib/msutil.jar"/>
<property name="database.driver"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="database.url"
value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=airline;User=Tester;Password=test"/>
<property name="database.userid" value="Tester"/>
<property name="database.password" value="test"/>
<property name="database.schema" value=""/>
<property name="database.catalog" value=""/>

<property name="jboss.datasource.mapping" value="MSSQL"/>
==========

thanks,

ken
Rod Macpherson
2002-12-10 00:53:01 UTC
Permalink
Most likely you need to set your schema value in the db config file.
That will fix the middlegen side however you have to remove the schema
prefix from the DD before feeding to ejbdoclet. I used the ant <replace>
task but if you have the latest cvs middlegen it apparently does not
output the schema - or has a switch.

-----Original Message-----
From: ***@keysolutions.com [mailto:***@keysolutions.com]
Sent: Monday, December 09, 2002 6:43 PM
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] can't find tables w/ MSSQL JDBC driver running
airline sample






Anyone see this msg before? I couldn't find it in the list archives.

file:J:/MiddleGen/samples/build.xml:140: middlegen.MiddlegenException:
Middlegen successfully connected to the database, but couldn't find any
tables. Perhaps the specified schema or catalog is wrong? -Or maybe
there aren't any tables in the database at all?

My config:
Ant 1.5.1
MiddleGen 2.0b1
JDK 1.4.1
MSSQL 2000 w/ latest JDBC driver

I ran "ant create-tables" successfully and I can see the tables in the
database. I also tried setting the schema to "dbo" since MSSQL seems
present tables with that as a prefix sometimes. I'm running this in the
MiddleGen samples directory. I can also run hsqldb-gui w/o problems,
though the tree looks a little weird (the first item is really tall and
it's blank).

I suppose I could punt and use one of the supported database drivers,
but the driver is listed on the MiddleGen web page as untested, so I
thought I'd be nice and try using it :-)

BTW, here's my mssqljdbc.xml file (goes in config\database). Feel free
to add it to the distribution: ===============
<property name="database.script.file"
value="${src.dir}/sql/${name}-mssql.sql"/>
<property name="database.driver.file"
value="j:/win32app/mssql/java/lib/mssqlserver.jar"/>
<property name="database.driver.classpath"
value="j:/win32app/mssql/java/lib/mssqlserver.jar;j:/win32app/mssql/java
/lib/msbase.jar;j:/win32app/mssql/java/lib/msutil.jar"/>
<property name="database.driver"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="database.url"
value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=airline;Us
er=Tester;Password=test"/>
<property name="database.userid" value="Tester"/>
<property name="database.password" value="test"/>
<property name="database.schema" value=""/>
<property name="database.catalog" value=""/>

<property name="jboss.datasource.mapping" value="MSSQL"/>
==========

thanks,

ken



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf _______________________________________________
middlegen-user mailing list middlegen-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/middlegen-user
k***@keysolutions.com
2002-12-10 00:57:01 UTC
Permalink
Post by Rod Macpherson
Most likely you need to set your schema value in the db config file.
That will fix the middlegen side however you have to remove the
schema
Post by Rod Macpherson
prefix from the DD before feeding to ejbdoclet. I used the ant
<replace>

Hi Rod,

I saw your posts on this and about the switch in the archives.
I'm at a level before that though. I'm just running "ant middlegen"
to
generate the files. Haven't gotten as far as ejbdoclet or xdoclet yet
:-(
Yes, I did try setting the schema in the db config file to "dbo" and
also
the "Tester" (the username used in the db config file) since they seem
to
show up as tables owned by "Tester" when you browse using the MSSQL
Enterprise Manager.


ken
k***@keysolutions.com
2002-12-10 01:30:01 UTC
Permalink
You may also want to make sure that the schema is set in the
middlegen
ant task. I included a sample below. The db config file only
provides

Ding!
The build.xml file in the samples directory has a middlegen tag w/
a blank "schema" attribute.
Change that line to:
schema="${database.schema}"

and it reads the schema in the DB config file.
You need to set "database.schema" to the username you're logging in as
when you create the tables for the airline sample.

I hope someone who is contributing to the middlegen source is reading
this. I'm not familiar w/ it enough to start mucking w/ CVS :-)

Thanks, Scott.


ken
Eivind Waaler
2002-12-10 06:25:04 UTC
Permalink
Hi, I see you figured out. That has been fixed in the CVS version 2 months
ago. I strongly recomend using the CVS version. Quite a few issues has
been reported with that beta release.

Also a note on the comment about removing the schema before running
ejbdoclet. I think that only matters when using jboss, at least it seems
to work fine in my weblogic server.

.eivind
Post by k***@keysolutions.com
You may also want to make sure that the schema is set in the
middlegen
ant task. I included a sample below. The db config file only
provides
Ding!
The build.xml file in the samples directory has a middlegen tag w/
a blank "schema" attribute.
schema="${database.schema}"
and it reads the schema in the DB config file.
You need to set "database.schema" to the username you're logging in as
when you create the tables for the airline sample.
I hope someone who is contributing to the middlegen source is reading
this. I'm not familiar w/ it enough to start mucking w/ CVS :-)
Thanks, Scott.
ken
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
k***@keysolutions.com
2002-12-10 12:33:03 UTC
Permalink
Post by Eivind Waaler
Hi, I see you figured out. That has been fixed in the CVS version 2
months
Post by Eivind Waaler
ago. I strongly recomend using the CVS version. Quite a few issues
has
Post by Eivind Waaler
been reported with that beta release.
Thanks. I got the latest beta hoping to avoid problems like
this. Any chance we'll see nightly builds? :-)


ken
Eivind Waaler
2002-12-10 12:58:05 UTC
Permalink
I don't think there will be nightly builds before the final 2.0 version is
released. But the cvs version should be quite stable, as it's being
prepared for release.

Setting up some automatic nightly builds would definately be a good idea.

.eivind
Post by Eivind Waaler
Post by Eivind Waaler
Hi, I see you figured out. That has been fixed in the CVS version 2
months
Post by Eivind Waaler
ago. I strongly recomend using the CVS version. Quite a few issues
has
Post by Eivind Waaler
been reported with that beta release.
Thanks. I got the latest beta hoping to avoid problems like
this. Any chance we'll see nightly builds? :-)
ken
Jon Finanger
2002-12-10 13:03:07 UTC
Permalink
I'm in the process of converting my 100+ tables database to CMP.
One little question:
When i lokk at the generated code the foreign key fields have two methods. one that returns the primary type (eg. int) and another
that returns the referenced bean. Why not only the last?

-Jon
Eivind Waaler
2002-12-10 13:21:03 UTC
Permalink
I'm not sure why. If it's a problem for you, it can be switched off with
the fkcmp flag in <cmp20> task i believe:

http://boss.bekk.no/boss/middlegen/plugins/cmp20.html#fkcmp

.eivind
Post by Jon Finanger
I'm in the process of converting my 100+ tables database to CMP.
When i lokk at the generated code the foreign key fields have two methods. one that returns the primary type (eg. int) and another
that returns the referenced bean. Why not only the last?
-Jon
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Jon Finanger
2002-12-11 10:22:02 UTC
Permalink
Hi!
I've seen that this has been a hot topic in lists around. I have the same problem as the rest, to use a foreign key as part of
primarykey in jboss. The ejb spec is talking about one to one relationships; wouldn't such relationship neccesary involve a pk on
one side and a foreignkey as pk on the other side? (unless we have a unique index on the field).
I've seen a suggestion on solution somewhere; Let the pk/fk field be a pk; set the pk using the fk object in ejbcreate; write a
ejbselect (or finder) that returns the fk.

Any other workaround to fool jboss regarding foeignkeys within a primarykey?


-Jon

[middlegen] (entitybean.Server ? ) WARNING (cmp20): The table zonesequenceitems has a primary key where the following columns also
are forei
gn keys: zoneid. Having set fkcmp="false" this will most likely cause problems at run time because those columns will not be
persisted, and therefore new instances will not set the key fields that correspond to foreign keys. The database might choke on
this.
Meyer-Willner, Bernhard
2002-12-11 10:31:07 UTC
Permalink
Nope, in addition to the JBoss restriction (NO FK can also be PK) is another
restriction: foreign key columns participating in CMRs can't have a NOT NULL
constraint in the DB. Since my DBA wouldn't allow me to disable those
constraints I had to implement the relationships the hard way (similarly to
what you mentioned). The first restriction might be fixed in JBoss 3.2 or
JBoss Head from CVS (which is Jboss 4 alpha). Try that..otherwise and for
the NOT NULL bug we'll probably have to wait until this is fixed in JBoss.

Bernie

-----Ursprüngliche Nachricht-----
Von: Jon Finanger [mailto:***@online.no]
Gesendet: Mittwoch, 11. Dezember 2002 13:21
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] Foreign key as/in primary key


Hi!
I've seen that this has been a hot topic in lists around. I have the same
problem as the rest, to use a foreign key as part of
primarykey in jboss. The ejb spec is talking about one to one relationships;
wouldn't such relationship neccesary involve a pk on
one side and a foreignkey as pk on the other side? (unless we have a unique
index on the field).
I've seen a suggestion on solution somewhere; Let the pk/fk field be a pk;
set the pk using the fk object in ejbcreate; write a
ejbselect (or finder) that returns the fk.

Any other workaround to fool jboss regarding foeignkeys within a primarykey?


-Jon

[middlegen] (entitybean.Server ? ) WARNING (cmp20): The table
zonesequenceitems has a primary key where the following columns also
are forei
gn keys: zoneid. Having set fkcmp="false" this will most likely cause
problems at run time because those columns will not be
persisted, and therefore new instances will not set the key fields that
correspond to foreign keys. The database might choke on
this.



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
middlegen-user mailing list
middlegen-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/middlegen-user

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Jon Finanger
2002-12-11 12:18:03 UTC
Permalink
This may be 'fixable' modifying some template. If its possible to detect this 'error' situation it should be possible to write a
template modification to handle this in a common way until jboss comes up with a solution. For all i know someone may already have
done this....?!?

If I get tired of manually adjust the beans i may have a look into it :-)

-Jon
Post by Rod Macpherson
-----Original Message-----
Meyer-Willner, Bernhard
Sent: 11. desember 2002 13:30
Subject: Re: [Middlegen-user] Foreign key as/in primary key
Nope, in addition to the JBoss restriction (NO FK can also be PK) is another
restriction: foreign key columns participating in CMRs can't have a NOT NULL
constraint in the DB. Since my DBA wouldn't allow me to disable those
constraints I had to implement the relationships the hard way (similarly to
what you mentioned). The first restriction might be fixed in JBoss 3.2 or
JBoss Head from CVS (which is Jboss 4 alpha). Try that..otherwise and for
the NOT NULL bug we'll probably have to wait until this is fixed in JBoss.
Bernie
-----Ursprüngliche Nachricht-----
Gesendet: Mittwoch, 11. Dezember 2002 13:21
Betreff: [Middlegen-user] Foreign key as/in primary key
Hi!
I've seen that this has been a hot topic in lists around. I have the same
problem as the rest, to use a foreign key as part of
primarykey in jboss. The ejb spec is talking about one to one relationships;
wouldn't such relationship neccesary involve a pk on
one side and a foreignkey as pk on the other side? (unless we have a unique
index on the field).
I've seen a suggestion on solution somewhere; Let the pk/fk field be a pk;
set the pk using the fk object in ejbcreate; write a
ejbselect (or finder) that returns the fk.
Any other workaround to fool jboss regarding foeignkeys within a primarykey?
-Jon
[middlegen] (entitybean.Server ? ) WARNING (cmp20): The table
zonesequenceitems has a primary key where the following columns also
are forei
gn keys: zoneid. Having set fkcmp="false" this will most likely cause
problems at run time because those columns will not be
persisted, and therefore new instances will not set the key fields that
correspond to foreign keys. The database might choke on
this.
-------------------------------------------------------
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary
material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained
or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
-------------------------------------------------------
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...