persistence@glassfish.java.net

Re: schema and catalog attributes of _at_Table

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 26 Sep 2006 14:30:39 -0700

Hi Varun,

Oracle does support catalogs, and schema name is your userid:
http://download-west.oracle.com/docs/cd/B19188_01/doc/B15917/squse.htm#sthref46

I would think it should be a user responsibility to provide only relevant info
(why would they specify catalog if it's not used in their database?). But you
can file an RFE for Derby to skip catalog name from the identifier.

thanks,
-marina

Varun Rupela wrote:
> Hi Marina:
>
> Yes. I think you are correct. A catalog is a collection of schemas. I
> Only found the following links to suggest that:
> http://www.tar.hu/sqlbible/sqlbible0098.html
> http://knowledgebase.datadirect.com/kbase.nsf/SupportLink%20Online/2548600HD?OpenDocument
>
> http://mailgate.supereva.com/comp/comp.databases.rdb/msg01094.html
>
> Also, it seems that not all databases support the concept of a catalog.
> (As far as I can tell, Derby and Oracle don't support catalog)
>
> So -
> 1. It looks like the wrong ddl is being generated when both the schema
> and catalog attributes are used in annotations or via xml mapping.
> Should I file a bug for this?
> 2. Should the generated ddl ignore the catalog attribute for databases
> that do not support catalog?
>
> thanks.
>
> varun.
>
>
> Marina Vatkina wrote:
>
>> Varun,
>>
>> I'm confused... shouldn't it be catalogName.schemaName.tableName?
>>
>> thanks,
>> -marina
>>
>> Varun Rupela wrote:
>>
>>> Hi:
>>>
>>> Using the schema and catalog attribute of @Table (or <table> in
>>> orm.xml) and using ddl-generation causes the generated ddl to have
>>> dotted table name references of the following type:
>>> schemaName.catalogName.tableName.
>>>
>>> Now, Derby doesn't like a statement "create table
>>> schemaName.catalogName.tableName" and throws an exception that the
>>> Provider logs with the following Warning:
>>> [TopLink Warning]: 2006.09.25
>>> 02:21:46.567--ServerSession(22591049)--Exception [TOPLINK-4002]
>>> (Oracle TopLink Essentials - 2006.8 (Build 060908)):
>>> oracle.toplink.essentials.exceptions.DatabaseException
>>> Internal Exception: org.apache.derby.client.am.SqlException: Syntax
>>> error: Encountered "." at line 1, column 36.Error Code: -1
>>> Call:CREATE TABLE
>>> schema_XML.catalog_XML.OverridingTableAnnotation_FROM_XML (ID BIGINT
>>> NOT NULL, DEPTNAME VARCHAR(255) NOT NULL, DEPTCOLORCODE VARCHAR(255)
>>> NOT NULL, PRIMARY KEY (ID))
>>> Query:DataModifyQuery()
>>>
>>> - After doing some search and speaking to some folks working on
>>> Derby, it seems that catalogName doesn't have a meaning when used as
>>> above. Is the ddl-generator expected to ignore the entry for catalog
>>> when generating ddl for Derby? Is this a bug?
>>> - Not using catalog but using schema generates a statement like
>>> "create table schemaName.tableName" which derby does execute correctly.
>>>
>>> Thanks.
>>>
>>> varun.