POST QUESTIONS ON THE FORUM! COMMENTS HERE SHOULD ADD VALUE TO THE PAGE!
!On 12 Aug 2004 22:32, ayush wrote:
>I'm trying to run middlegen against an oracle database. It does
>connect to the db and finds the table in question but I get the
>following message:
>middlegen.MiddlegenException: Wow! Synonym DWPTD not found. How can it
>happen?
>Anyone knows what this means?
>- ayush
I've just come across this and I suspect it might be a small bug in
middlegen. If you look at getSynonymOwner() on MiddlegenPopulator.java,
the SQL is as follows:
select table_owner from sys.all_synonyms where table_name=? and owner=?
PreparedStatement variables are set as follows:
ps.setString(1, synonymName);
ps.setString(2, _schema);
Now, the structure of the oracle table sys.all_synonyms looks like this:
SQL> desc sys.all_synonyms;
Name Null? Type
----------------------------------------- ------- --------
OWNER NOT NULL VARCHAR2(30)
SYNONYM_NAME NOT NULL VARCHAR2(30)
TABLE_OWNER VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
DB_LINK VARCHAR2(128)
So, looking at the method, it appears that the idea is to get the
synonym owner given the SYNONYM_name (and NOT the table_name). This
implies the SQL ought to read:
select table_owner from sys.all_synonyms where synonym_name=? and owner=?
I've only just spotted this (in my copy of the middlegen 2.1 source) so
I'm not sure if this is the crux of the matter. Hope it helps
Joe |