Menu

#180 Wow! Synonym asdf not found. How can it happen?

open
5
2005-06-18
2005-06-18
Anonymous
No

When I fired up middlegen with the hibernate plugin (I
doubt that part matters) I got:

C:\Projects\LDTOOLS\tts\apps\tts-common\build.xml:86:
middlegen.MiddlegenException: Wow! Synonym
TLG_PROCESSING_ERRORS_SQ not found. How can it happen?

Which was fun, because the object
TLG_PROCESSING_ERRORS_SQ is a synonym to a sequence.
This was actually necessary at one point when changing
namnig conventions and needing to keep some code
compatible. We're in the ancient world of Oracle
8.0.0.6 (please don't laugh) and I broke your code
(yippe! :). Luckily, I could point to our production
database and get this to work.

Thanks for a cool product, this is fun (learning
Middlegen)! :)

Middlegen 2.1
Ant 1.6.5
log4j 1.2.9
junit 3.8.1
velocity 1.4
hibernate 3.0.5
Oracle driver (not sure of version, 1.2 I'm thinking)
Oracle 8.0.0.6 (ancient, not 8i)

Email me if you need more info about this. Here is the
data from the database (formatted to read here more easily)

SQL> select * from user_synonyms where
synonym_name='TLG_PROCESSING_ERRORS_SQ';

SYNONYM_NAME: TLG_PROCESSING_ERRORS_SQ
TABLE_OWNER: FTSDEV
TABLE_NAME: TLG_PROCESSING_ERRORS_1SQ
DB_LINK:

SQL> select * from user_sequences where
sequence_name='TLG_PROCESSING_ERRORS_1SQ';

SEQUENCE_NAME: TLG_PROCESSING_ERRORS_1SQ
MIN_VALUE: 1
MAX_VALUE: 1000000000
INCREMENT_BY: 1
CYCLE_FLAG: N
ORDER_FLAG: N
CACHE_SIZE: 0
LAST_NUMBER: 729668

Daniel
daniel.santos@pobox.com

Discussion

  • Dave Smith

    Dave Smith - 2005-07-04

    Logged In: YES
    user_id=173420

    I get the same with Oracle if I go anywhere near a synonym.

     
  • David Channon

    David Channon - 2005-07-10

    Logged In: YES
    user_id=582419

    There have been changes recently (after 2.1 release) to the
    Synonym processing. The expectation is that the Synonym
    is one for a Table not sequence.. Don't have a setup to test
    this out at the moment. Try CVS version and get back to me.
    Thanks.

     
  • David Channon

    David Channon - 2005-07-10

    Logged In: YES
    user_id=582419

    There have been changes recently (after 2.1 release) to the
    Synonym processing. The expectation is that the Synonym
    is one for a Table not sequence.. Don't have a setup to test
    this out at the moment. Try CVS version and get back to me.
    Thanks.

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,

    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.

    Joe

     
  • Vitor Santos

    Vitor Santos - 2006-02-01

    Logged In: YES
    user_id=334993

    I have the same problem and i saw the source code
    and where is table_name in the where clause

    select table_owner from sys.all_synonyms where table_name=?
    and owner=?

    should by synonym_name
    select table_owner from sys.all_synonyms where
    synonym_name=? and owner=?

     

Log in to post a comment.