Discussion:
[Middlegen-user] Schema problem in middlegen ant task
Olaf Bergner
2004-07-26 14:16:02 UTC
Permalink
I am trying to generate hbm files for a fairly complex oracle database. My
limited understanding of oracle's innards tells me that upon connecting to
the db via my username I reach the default schema associated with my
username ("obergner"). I am not sure in how far this affects the rather
strange output of my experiments with middlegen so far. Anyway, in
build.xml:

<snip>
<property name="database.driver"
value="oracle.jdbc.driver.OracleDriver"/>
<property name="database.url"
value="jdbc:oracle:thin:@XXXXXXXXXXXXXX:EWS"/>
<property name="database.userid" value="obergner"/>
<property name="database.password" value="XXXXXXXXXXX"/>
<property name="database.schema" value="OBERGNER"/>
<property name="database.catalog" value=""/>

...

<middlegen
appname="${name}"
prefsdir="${gensrc.prefs.dir}"
gui="${gui}"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
(No tables specified)
</middlegen>
</snip>

Running this skript gives me:

<snip>
middlegen:
[echo] Class path = C:\Projekte\obergner\StandardWorkspace\HibernateEWS
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
simple->middlegen.Plugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
java->middlegen.javax.JavaPlugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
plugin->middlegen.Plugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
hibernate->middlegen.plugins.hibernate.HibernatePlugin
[middlegen] Database URL:jdbc:oracle:thin:@ewsdb.vpn.ision.net:1521:EWS
[middlegen] No <table> elements specified. Reading all tables. This might
take a while...

BUILD FAILED
C:\Projekte\obergner\StandardWorkspace\HibernateEWS\build.xml:69:
middlegen.Midd
legenException: The table named ADS_REACTION was found both in the schema
named
OBERGNER and in the schema named OBERGNER. You have to specify
schema="something
" in the middlegen task.
</snip>

which is obviously nonsense.

If, however, I add a <table> element with an unqualified (without schema
part) table name all works as expected. Now specifying 200+ tables by hand
seems rather tedious, so I would be very thankful if someone could point me
to my error and how I might correct it.

Cheers,

Olaf
Olaf Bergner
2004-08-06 17:35:01 UTC
Permalink
Sorry for bothering you but this problem turns out to be a real showstopper,
potentially blocking our switch to Hibernate. I have been trying to resolve
this problem for quite a while now, but to no effect. Here's some additional
info, though:

The oracle db I am talking to holds more or less identical snapshots of the
target db under different schemas. There is one production schema and one
test schema for each of our developers named after their usernames. When
connecting to the oracle server via his username/password combination each
developer will hit his schema.

This is what happens: If I specify my username "obergner" in database.userid
as well as in database.schema (i.e. I will hit my schema when connecting to
oracle and middlegen will use the correct schema name) I get that funny
message

BUILD FAILED
C:\Projekte\obergner\StandardWorkspace\HibernateEWS\build.xml:69:
middlegen.MiddlegenException: The table named ADS_REACTION was
found both in the schema named OBERGNER and in the schema named
OBERGNER. You have to specify schema="something" in the middlegen
task.

which leaves me rather puzzled. If I specify a fellow developers username in
database.userid as well as in database.schema I get a similar message, only
with "OBERGNER" replaced by the new username.

If I specify no schema, middlegen complains about that, as I would expect.

If I specify my username in database.userid as well as in database.schema
and specify a _fully qualified_ (i.e. OBERGNER.TABLENAME) middlegen will
complain about OBERGNER.TABLENAME not being found.

The only thing that works is specifying my username in database.userid as
well as database.schema and specify unqualified tablenames. Which leaves me
with several hundred tables to be manually added to my ant script. That's
obviously no option.

So what can it be I am doing wrong here, and - most importantly - is there a
way to fix my problem? Any help/suggestions would be very much appreciated.

Cheers,

Olaf
-----Ursprüngliche Nachricht-----
Bergner
Gesendet: Montag, 26. Juli 2004 18:15
An: Middlegen User List
Betreff: [Middlegen-user] Schema problem in middlegen ant task
I am trying to generate hbm files for a fairly complex oracle database. My
limited understanding of oracle's innards tells me that upon connecting to
the db via my username I reach the default schema associated with my
username ("obergner"). I am not sure in how far this affects the rather
strange output of my experiments with middlegen so far. Anyway, in
<snip>
<property name="database.driver"
value="oracle.jdbc.driver.OracleDriver"/>
<property name="database.url"
<property name="database.userid" value="obergner"/>
<property name="database.password" value="XXXXXXXXXXX"/>
<property name="database.schema" value="OBERGNER"/>
<property name="database.catalog" value=""/>
...
<middlegen
appname="${name}"
prefsdir="${gensrc.prefs.dir}"
gui="${gui}"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
(No tables specified)
</middlegen>
</snip>
<snip>
[echo] Class path =
C:\Projekte\obergner\StandardWorkspace\HibernateEWS
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
simple->middlegen.Plugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
java->middlegen.javax.JavaPlugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
plugin->middlegen.Plugin
[middlegen] (middlegen.Middlegen 350 ) Registering plugin
hibernate->middlegen.plugins.hibernate.HibernatePlugin
[middlegen] No <table> elements specified. Reading all tables. This might
take a while...
BUILD FAILED
middlegen.Midd
legenException: The table named ADS_REACTION was found both in the schema
named
OBERGNER and in the schema named OBERGNER. You have to specify
schema="something
" in the middlegen task.
</snip>
which is obviously nonsense.
If, however, I add a <table> element with an unqualified (without schema
part) table name all works as expected. Now specifying 200+ tables by hand
seems rather tedious, so I would be very thankful if someone
could point me
to my error and how I might correct it.
Cheers,
Olaf
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...