REFs vs. Foreing Key.

Hi,
I am new in ORACLE Objects technology.
In my database i have two tables and i want to connect them. I usually use the primary-foreing key concept.
I want to know if REF has best perfomance than foreing key? or the only advantage is the deref functionality of SQL?
Does somebody know something about it?
Thanks
Fernando Fiszman

I'll disagree with that.
A REF is very much like a foreign key. The REF is more flexible because a REF of a particular type is not limited to pointing to exactly one table as a FK is. But a FK is more stabile because it's validity is guaranteed, whereas a REF can dangle. The impact of this is that the REF will support a wider variety of modelling scenarios, but may suffer from integrity problems unless you SCOPE the REF, in which case it is very much like an FK as it must point to exactly one table.
The REF is a pointer who's VALUE is hidden from the user, which violates Codd's information principle. This will be an issue during replication and data migration. De-referencing REFs is very much like the 'pointer chasing' that was so prevalent in pre-relational databases. The relational equivalent of 'de-referencing a REF' is joining a foreign key to it's associated primary key and returning the row of the parent table.
Anyway, while I guess it is true that an FK and a REF are different beasts, they are very similar, and it is not incorrect to view them as related.
Chris

Similar Messages

  • Create Foreing Key to one table in different dataBase

    Hi, I need create a reference to one table in other database. I understand that Database Link can be used to connect me to other database but when I am creating the foreing key in my table, I can see only the tables in the schemas that have my data base not the other schemas. I created a connection with database link but I do not see the form to make reference to this connection from the create table wizard. I am using Oracle 9i and the client is 9.01.01.
    Thanks in advance,
    Mónica Alarcón

    We cannot use tables in another table to enforce data integrity. This makes a lot of sense if you think about what would happen if the remote database goes down.
    If you want to do this, then you need to use replication (materilaized view) to bring the parent table's data into the locaL database.
    Cheers, APC

  • Insufficient privileges in Foreing Key

    I created a table in user2 schema (Oracle 8.1.5)
    Create table test (company number(2));
    Then i try to add a foreing key
    ALTER TABLE test
    ADD ( FOREIGN KEY (company)
    REFERENCES otheruser.COMPANY);
    I always get the ORA-01031 error (insufficient privileges)
    user2 is DBA and otheruser too. I tried all the grant options...
    Can anyone give me a detail script...
    Thanks.
    Antonio

    I think you are not having alter any table privilege, Any how
    here is the syntax:
    Alter table test add constraint fk_test foreign key(company)
    references otheruser.table_name(col_name);
    Regards,
    G. Rajakumar.

  • Refer to the 'key' in a LOV

    Hi All
    how do i refer to the 'key' in a LOV (key - value)?
    for example: my LOV is : 1;one,2;two,3;three.
    :PX_ITEM will return the 'value' (one, two, three). how do i refer to (1, 2, 3) ?
    thanx

    Hi Liron,
    Yes - I'm assuming that the data is available from a table. As I don't know your tables, I've used "descriptionfieldname", "idfieldname" and "table" - replace these to return the name of the field that contains the description you want in the column heading, the name of the field that contains the LOV key ID and the name of the table that contains the LOV data.
    I don't know why apex_item.text_from_lov doesn't work from with the header definition (it could be because this is normally used to create the tabular form?) - hence suggesting that you retrieve the text you need using a normal select statement.
    Regards
    Andy

  • FOREING KEY URGENT

    Hello.
    I create a view to unite two tables, I want to know if the primary key of the view can index it as foreing key in another table to create a relationship master -details.
    I thank the collaboration that you can lend me

    At data base level you cannot do that.
    But in the form you can create a master/detail relation ship.

  • Foreing key between schemas

    I'm trying to create a foreing key constraint, between tables in diferents schemas. but i get ora-01031 insufficient privileges error, which is the system privilege that i need?

    At data base level you cannot do that.
    But in the form you can create a master/detail relation ship.

  • How to refer the unlimited key length JCE jar files.

    Hi All,
    The JDK 1.4.2_10 contains the local_policy.jar and US_export_policy.jar that do not permit an unlimited Key length( 64 bit).
    - So I downloaded the unlimited ( Java(TM) Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 1.4.2
    ) https://jsecom15d.sun.com/ECom/EComActionServlet;jsessionid=0F59ACFF95A61F6C0E78B5CE8E0FA93B.
    -Now I want JDK to refer these files without changing anything in existing JDK ( Means I don't want to replcae the existing local_policy.jar , US_export_policy.jar ).
    - Is there any option or property which can tell the JDK to refer the other
    files instead of this location :- C:\bea\WLS8.1SP04\jdk142_05\jre\lib\security.
    Means I want to override these 2 existing files local_policy.jar , US_export_policy.jar without replcaing them.
    Any pointers will be highly appreciated.

    A year later, this is still an issue. No replies ( btw, this is my new login name for the forums ).
    Thank You.

  • Create WDA Input field for currency amount ref to curr key

    Hi Experts,
    Could the UI elements in WDA input fields have a key reference? If that possible, how to do that?
    For example: currency amount input field referenced to Curr key?or quantity ref to UoM field.
    Regards,
    Agnis Virtinova Avency

    Hello Agnis Virtinova Avency,
    WDA uses ABAP dictionary structures for this kind of linking - define your amount and currency as part of a standard ABAP structure - then link the two fields in the structure as per normal ABAP data dictionary . Then use this structure to define your context node.
    This is the same approach you should use if you have multiple fields that should input to or output from a DDIC search help.
    This means that if you choose - for example CLP (Chilean Peso) as the currency, then the decimal places on the amount field are removed.
    Hope this is what you were looking for.
    Cheers,
    Chris

  • Foring Key Columns

    After usage of Database Design Transformer I've accept Server Model Diagramm without FK Columns. All FK and relation in ER is OK.
    When I've generate DDL scripts for tables I have not seen this columns eather.
    Whats wrong (excluding my english :))?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Gints Plivna ([email protected]):
    A little bit didn't understand
    1. If You haven't FK columns and Foreign Keys on tables You cannot generate tables with them :)
    2. If You have these columns and keys then check options -> general options -> database -> "generate integrity constraints" and "foreign key generation requires join table" assuming you are using Design Editor 6.xxx
    <HR></BLOCKQUOTE>
    Thank You for help, but problem occured when'
    I use Transformer. I try to solve it by Your advise, but it only possible if Database Design Transformer uses Design Editor Preferences.
    I did not generate tables I've jult look through DDL scripts and have not found any FK columns.
    The main problem is 'I have not ANY FK columns in my Server Model Diagramm'
    Thanks & Regards
    Viktor
    null

  • Foreing key 와 Primary key 비교해서 결과 추출

    안녕하세요
    참조 하고 있는 테이블을 비교하고 싶어서요.
    A테이블의 . pk 컬럼과 B테이블의 fk. 컬럼이 서로 부모,자식으로
    연결되었다고 가정하면 두 테이블을 비교해서 다른 컬럼(즉 Foreign key이 깨진것)
    을 확인하고 싶어요.....간단하면서 막상 할려니 머리를 헤매네요...
    ( FILES.filesid 와 ITEM.itemsno)를 조인해서 한쪽에 없는 값을
    리스트로 출력할려구요..
    글 수정:
    user541094

    원래 포럼에 너무 제가 글을 많이 써서 자제를 하려고 했는데..
    temp관련해서 스크립트를 실수해서 글 수정하다가..
    답변드립니다.
    부모자식관계는 아래와 같이 확인하시면 됩니다.
    dept테이블의 deptno 컬럼을 pk로 하고, emp테이블에서 dept의 deptno 컬럼을 reference해서 사용합니다.
    즉 부모가 dept 테이블 이고 자식이 emp 테이블
    ### dept(deptno가 pk) -< emp(deptno가 fk)
    SQL> alter table dept add constraints pk_deptno primary key (deptno);
    Table altered.
    Elapsed: 00:00:00.40
    SQL> alter table emp add constraints fk_deptno
    2 foreign key (deptno)
    3 references dept
    4 /
    ## fk_const_to.sql
    DOC
    file: fk_const.sql
    자신의 테이블에서 다른 테이블의 pk를 받아서 FK가 되는 경우,
    자식을 넣으면 부모가 출력
    dept(deptno가 pk) -< emp(deptno가 fk) 일 경우 emp를 넣으면
    dept 테이블 출력
    set line 132
    col owner format a10 heading 'Pk_owner'
    column table_name format a15 heading 'Pk_table'
    column const_name format a15 heading 'Pk_const'
    column referencing_table format a25 heading 'Ref_Table'
    column referencing_table format a15 heading 'Fk_Table'
    column foreign_const format a15 heading 'Fk_Const'
    column fk_status format a8 heading 'Fk_Status'
    column key_column format a8 heading 'Key_col'
    column validated format a8 trunc
    column DEFERRED format a8 trunc
    column DEFERRABLE format a8 trunc
    select a.owner,
    a.table_name,
    a.constraint_name const_name,
    b.table_name referencing_table,
    b.constraint_name foreign_const,
    c.column_name key_column,
    b.status fk_status,
    b.validated ,
    b.deferred,
    b.deferrable
    from dba_constraints a, dba_constraints b, all_cons_columns c
    where
    a.owner=b.owner and a.owner=c.owner
    and a.constraint_name= c.constraint_name
    and a.constraint_name = b.r_constraint_name
    and b.table_name = upper('&table_name')
    and b.constraint_type = 'R'
    and a.owner not in ('SYS','SYSTEM','OUTLN','PERFSTAT')
    order by 1,2,3,4
    clear columns
    - 결과
    Enter value for table_name: emp
    old 16: and b.table_name = upper('&table_name')
    new 16: and b.table_name = upper('emp')
    PK owner PK_table PK_const Fk_Table Fk_Const Key_col Fk_Statu VALIDATE DEFERRED DEFERRAB
    SCOTT DEPT PK_DEPTNO EMP FK_DEPTNO DEPTNO ENABLED VALIDATE IMMEDIAT NOT DEFE
    ## fk_const_from.sql
    DOC
    file: fk_const_from.sql
    다른 테이블의 fk가 자신의 테이블의 pk를 reference하는 경우,
    부모를 넣으면 자식이 출력,
    dept(deptno가 pk) -< emp(deptno가 fk) 일 경우 dept를 넣으면
    emp 테이블 출력
    set line 132
    col owner format a10 heading 'Pk_owner'
    column table_name format a15 heading 'Pk_table'
    column const_name format a15 heading 'Pk_const'
    column referencing_table format a25 heading 'Ref_Table'
    column referencing_table format a15 heading 'Fk_Table'
    column foreign_const format a15 heading 'Fk_Const'
    column fk_status format a8 heading 'Fk_Status'
    column key_column format a8 heading 'Key_col'
    column validated format a8 trunc
    column DEFERRED format a8 trunc
    column DEFERRABLE format a8 trunc
    select a.owner,
    a.table_name,
    a.constraint_name const_name,
    b.table_name referencing_table,
    b.constraint_name foreign_const,
    c.column_name key_column,
    b.status fk_status,
    b.validated ,
    b.deferred,
    b.deferrable
    from dba_constraints a, dba_constraints b, all_cons_columns c
    where
    a.owner=b.owner and a.owner=c.owner
    and a.constraint_name= c.constraint_name
    and a.constraint_name = b.r_constraint_name
    and a.table_name = upper('&table_name')
    and b.constraint_type = 'R'
    and a.owner not in ('SYS','SYSTEM','OUTLN','PERFSTAT')
    order by 1,2,3,4
    clear columns
    Enter value for table_name: dept
    old 16: and a.table_name = upper('&table_name')
    new 16: and a.table_name = upper('dept')
    PK owner PK_table PK_const Fk_Table Fk_Const Key_col Fk_Statu VALIDATE DEFERRED DEFERRAB
    SCOTT DEPT PK_DEPTNO EMP FK_DEPTNO DEPTNO ENABLED VALIDATE IMMEDIAT NOT DEFE

  • Foreing keys works only when created as CAPITAL?

    Hello,
    When working with HTML DB tutorial, I have noticed that foreign keys works only when I do create them as CAPITAL. I did create some foreign keys manually, and when I was trying "query by example" it did not work correctly unles I did re-create the foreign keys using all captials in their name. Why is it that?
    Thank you,
    DanielD

    I let it dry out more and it started working. It still has a quirk or two but I can live with it.

  • Can foreign key refer to unique key?

    Hi....

    If you join that table x with table y using a
    WHERE x.pk_column = y.fk_columnpredicate. Then the rows with "matching" NULL's will not show up in the query result.
    But this has nothing to do with an FK referencing a UK.
    It has everything to do with how NULL's are treated in the SQL standard.
    A predicate like:
    NULL = NULLwill evaluate to FALSE (that's just how SQL treats NULL's in this case).

  • Foreing Key association didn't create for mysql database

    Hi,
    I Am new to adf business components. I Am using jdeveloper 11g and mysql5.1 i tried just create one master detail entry, but i can't create association entity class using adf business components. How can i create this? Please help me.
    Thanks advance...

    ํำํyes, I already delete the file. However, I try to create new blank file and named it as <SID>ALRT.LOG. After that I try to switch log file, nothing write onto this file. I also restart database after create new blank file and nothing happen. I will wait for an hour as you comment and will update the status.
    Thanks in advance.

  • Wrong order foreign key constraints

    Hi,
    i have problems with non-deferred foreing key constraints:
    I have a table "PERSON" and a table "ADRESSE" which has a foreign key
    to "PERSON". Both tables have primary keys with two columns.
    In the mappings I use application identity. The mappings are generated by
    xdoclet.
    We cannot use deferred constraint because we have to support following
    databases: Oracle, Firebird, MS SQL, DB2.
    I tested the mappings with Oracle and Firebird and got this exception
    (with SQL Trace):
    5602 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (1 errors)>
    [15 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 1, (String) [email protected], (String)
    04941 183742, (int) 12761, (int) 1, (int) 1, (String) 0171 2846751,
    (String) Oldenburg, (int) 12760, (String) 26129, (int) 1, (null) null,
    (String) Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=0]
    5602 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 3, (null) null, (null) null, (int) 12764,
    (int) 1, (int) 0, (null) null, (String) Sylt, (int) 12759, (String) 25980,
    (int) 0, (null) null, (String) Stephanstra__e 47, (String) 04651 19283]
    [reused=1]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 13390902 INSERT INTO VAMP.PERSON (ANREDEID, ID,
    KUNDENNR, LOESCHBEMERKUNG, MANDANTID, NAME1, NAME2, PERSONENDATUM,
    PERSONENORT, TYP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(null)
    null, (int) 12759, (String) 9999452800, (null) null, (int) 1, (String)
    Horstmann, (String) Manfred, (Timestamp) 1959-03-10 00:00:00.381, (String)
    Flensburg, (int) 1] [reused=0]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 1, (String) [email protected], (String)
    04941 183742, (int) 12763, (int) 1, (int) 1, (String) 0171 2846751,
    (String) Oldenburg, (int) 12759, (String) 26129, (int) 1, (null) null,
    (String) Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=2]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 3, (null) null, (null) null, (int) 12762,
    (int) 1, (int) 0, (null) null, (String) Sylt, (int) 12760, (String) 25980,
    (int) 0, (null) null, (String) Stephanstra__e 47, (String) 04651 19283]
    [reused=3]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 13390902 INSERT INTO VAMP.PERSON (ANREDEID, ID,
    KUNDENNR, LOESCHBEMERKUNG, MANDANTID, NAME1, NAME2, PERSONENDATUM,
    PERSONENORT, TYP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(null)
    null, (int) 12760, (String) 9999452801, (null) null, (int) 1, (String)
    Horstmann, (String) Christine, (Timestamp) 1972-03-10 00:00:00.381,
    (String) Erfurt, (int) 1] [reused=1]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 11320634 INSERT INTO VAMP.NATPERSON
    (ANZAHLKINDER, ARBEITGEBERID, BEITRAGSSATZ, BERUFID, BRANCHEID,
    FAMILIENSTAND, FAMSTANDSEIT, FINANZAMTID, GEBIETSFREMDERAWG, GUETERSTAND,
    IDBEHOERDE, IDNR, KIRCHENSTEUER, KVID, MANDANTID, PERSONID, PRIVATKV,
    STAAT, STEUERBERATERID, STEUERKLASSE, STEUERNR, STEUERTARIF, TITEL) VALUES
    [params=(int) 0, (null) null, (double) 0.0, (null) null, (int) 12410,
    (int) 2, (Timestamp) 1991-12-12 00:00:00.381, (null) null, (int) 0, (int)
    3, (null) null, (null) null, (int) 0, (int) 12576, (int) 1, (int) 12760,
    (int) 0, (null) null, (null) null, (int) 0, (null) null, (int) 1, (null)
    null] [reused=0]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 11320634 INSERT INTO VAMP.NATPERSON
    (ANZAHLKINDER, ARBEITGEBERID, BEITRAGSSATZ, BERUFID, BRANCHEID,
    FAMILIENSTAND, FAMSTANDSEIT, FINANZAMTID, GEBIETSFREMDERAWG, GUETERSTAND,
    IDBEHOERDE, IDNR, KIRCHENSTEUER, KVID, MANDANTID, PERSONID, PRIVATKV,
    STAAT, STEUERBERATERID, STEUERKLASSE, STEUERNR, STEUERTARIF, TITEL) VALUES
    [params=(int) 0, (null) null, (double) 0.0, (int) 12362, (int) 12378,
    (int) 2, (Timestamp) 1991-12-12 00:00:00.381, (null) null, (int) 0, (int)
    3, (null) null, (null) null, (int) 0, (int) 12576, (int) 1, (int) 12759,
    (int) 0, (null) null, (null) null, (int) 0, (null) null, (int) 1, (null)
    null] [reused=1]
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> [16 ms] rollback
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> return
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> [0 ms] close
    com.solarmetric.jdbc.ReportingSQLException: ORA-02291: integrity
    constraint (VAMP.ADRESSE_PS) violated - parent key not found
    {prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART, EMAIL, FAXNR,
    ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ, POSTADRESSE,
    POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?) [params=(int) 1, (String) [email protected], (String) 04941
    183742, (int) 12761, (int) 1, (int) 1, (String) 0171 2846751, (String)
    Oldenburg, (int) 12760, (String) 26129, (int) 1, (null) null, (String)
    Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=0]} [code=2291,
    state=23000]
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:124)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.access$600(LoggingConnectionDecorator.java:19)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:728)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
    How can I force it to insert in the table "NATPERSON" first and then in
    the table "ADRESSE"?
    I use following JDBC-drivers:
    Firebird: 1.5.5
    Oracle: 9.2.0.1.0
    My property file:
    <!-- standard properties for all dbms -->
    <prop key="kodo.LicenseKey">LICENSE KEY REMOVED</prop>
    <prop key="kodo.ConnectionFactoryProperties">MaxCachedStatements=150,
    MaxActive=50, MaxIdle=50</prop>
    <prop key="kodo.FetchBatchSize">200</prop>
    <prop key="kodo.DataCache">true(CacheSize=5000)</prop>
    <prop key="kodo.RemoteCommitProvider">sjvm</prop>
    <prop key="kodo.jdbc.MappingFactory">metadata</prop>
    <prop key="kodo.jdbc.ForeignKeyConstraints">true</prop>
    <prop key="kodo.jdbc.SchemaFactory">native</prop>
    <prop
    key="javax.jdo.PersistenceManagerFactoryClass">kodo.jdbc.runtime.JDBCPersistenceManagerFactory</prop>
    <prop key="javax.jdo.option.Optimistic">true</prop>
    <!-- oracle connection properties -->
    <prop key="kodo.jdbc.DBDictionary">oracle</prop>
    <prop
    key="javax.jdo.option.ConnectionDriverName">oracle.jdbc.driver.OracleDriver</prop>
    <prop key="javax.jdo.option.ConnectionURL">..</prop>
    <prop key="javax.jdo.option.ConnectionUserName">..</prop>
    <prop key="javax.jdo.option.ConnectionPassword">..</prop>
    <prop key="kodo.jdbc.SequenceFactory">native</prop>
    <prop key="kodo.jdbc.Schemas">..</prop>
    <!-- firebird connection properties
    <prop key="kodo.jdbc.DBDictionary">kodo.jdbc.sql.FirebirdDictionary</prop>
    <prop
    key="javax.jdo.option.ConnectionDriverName">org.firebirdsql.jdbc.FBDriver</prop>
    <prop key="javax.jdo.option.ConnectionURL">..</prop>
    <prop key="javax.jdo.option.ConnectionUserName">..</prop>
    <prop key="javax.jdo.option.ConnectionPassword">..</prop>
    <prop key="kodo.jdbc.SequenceFactory">native(TableName=SYSDUAL,
    Format="SELECT GEN_ID({0},1) FROM {1}")</prop>
    -->
    My database schema looks like this:
    TABLE PERSON
    FIELD MANDANTID (SMALLINT REQUIRED COMMENT (""))
    FIELD ID (AUTOINC COMMENT (""))
    FIELD TYP (SMALLINT REQUIRED COMMENT (""))
    FIELD KUNDENNR (CHAR(15) COMMENT ("Kundennummer"))
    PRIMARY KEY
    FIELD MANDANTID
    FIELD ID
    FOREIGN KEY MD
    TABLE MANDANT
    FIELD MANDANTID
    INDEX KDNR
    FIELD MANDANTID
    FIELD KUNDENNR
    UNIQUE
    TABLE ADRESSE
    FIELD MANDANTID (SMALLINT REQUIRED COMMENT (""))
    FIELD ID (AUTOINC COMMENT (""))
    FIELD PERSONID (LONGINT REQUIRED COMMENT (""))
    PRIMARY KEY
    FIELD MANDANTID
    FIELD ID
    FOREIGN KEY PS
    TABLE PERSON
    FIELD MANDANTID
    FIELD PERSONID
    My metadata looks like this:
    <class name="PersonDO"
    identity-type="application"
    objectid-class="com.elaxy.vamp.dom.person.PersonDOId"
    persistence-capable-superclass="com.elaxy.vamp.dom.AbstractDO">
    <extension vendor-name="kodo"
    key="jdbc-class-ind"
    value="metadata-value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-ind/column"
    value="TYP">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-ind-value"
    value="-1">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map"
    value="base">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map/table"
    value="PERSON">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map/column"
    value="ID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map/column"
    value="MANDANTID">
    </extension>
    <field name="kundenNr"
    persistence-modifier="persistent">
    </field>
    <field name="adressen"
    persistence-modifier="persistent">
    <collection
    element-type="com.elaxy.vamp.dom.person.AdresseDO">
    </collection>
    <extension vendor-name="kodo"
    key="jdbc-field-map"
    value="one-many">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.MANDANTID"
    value="MANDANTID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.ID"
    value="PERSONID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/table"
    value="ADRESSE">
    </extension>
    </field>
    .. fields ..
    </class>
    <class name="AdresseDO"
    identity-type="application"
    objectid-class="com.elaxy.vamp.dom.person.AdresseDOId"
    persistence-capable-superclass="com.elaxy.vamp.dom.AbstractDO">
    <extension vendor-name="kodo"
    key="jdbc-class-map"
    value="base">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map/table"
    value="ADRESSE">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-sequence-name"
    value="ADRESSE_SEQ">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map/column"
    value="ID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map/column"
    value="MANDANTID">
    </extension>
    .. fields ..
    </class>
    Many thanks,
    Jan

    Marc
    This is a part of the output from the "schemagen" tool:
    <schemas>
    <schema name="VAMP">
    <table name="ADRESSE">
    <pk name="ADRESSE_PRIMARY">
    <on column="ID"/>
    <on column="MANDANTID"/>
    </pk>
    <column name="ADRESSART" type="decimal" type-name="NUMBER"
    size="5"/>
    <column name="EMAIL" type="varchar" type-name="VARCHAR2"
    size="30"/>
    <column name="FAXNR" type="varchar" type-name="VARCHAR2"
    size="25"/>
    <column name="ID" type="decimal" type-name="NUMBER"
    not-null="true" size="10"/>
    <column name="LAND" type="decimal" type-name="NUMBER"
    size="10"/>
    <column name="MANDANTID" type="decimal" type-name="NUMBER"
    not-null="true" size="5"/>
    <column name="MELDEADRESSE" type="decimal" type-name="NUMBER"
    size="1"/>
    <column name="MOBILNR" type="varchar" type-name="VARCHAR2"
    size="25"/>
    <column name="ORT" type="varchar" type-name="VARCHAR2"
    size="30"/>
    <column name="PERSONID" type="decimal" type-name="NUMBER"
    not-null="true" size="10"/>
    <column name="PLZ" type="varchar" type-name="VARCHAR2"
    size="5"/>
    <column name="POSTADRESSE" type="decimal" type-name="NUMBER"
    size="1"/>
    <column name="POSTFACH" type="varchar" type-name="VARCHAR2"
    size="10"/>
    <column name="STRASSE" type="varchar" type-name="VARCHAR2"
    size="30"/>
    <column name="TELEFONNR" type="varchar" type-name="VARCHAR2"
    size="25"/>
    <fk name="ADRESSE_PS" delete-action="cascade"
    to-table="VAMP.PERSON">
    <join column="MANDANTID" to-column="MANDANTID"/>
    <join column="PERSONID" to-column="ID"/>
    </fk>
    <index name="ADRESSE_ORT">
    <on column="MANDANTID"/>
    <on column="ORT"/>
    </index>
    <index name="ADRESSE_PLZ">
    <on column="MANDANTID"/>
    <on column="PLZ"/>
    </index>
    <index name="ADRESSE_PS">
    <on column="MANDANTID"/>
    <on column="PERSONID"/>
    </index>
    <index name="ADRESSE_STR">
    <on column="MANDANTID"/>
    <on column="STRASSE"/>
    </index>
    </table>
    The foreign key "ADRESSE_PS" was identified correctly.
    I've taken a look at the class OracleDictionary and it seems that the
    object "ForeignKey" considers only one column from the foreign keys -
    but I use foreign keys that include two columns ("MANDANTID", "PERSONID").
    Is that right or are foreign keys with two columns allowed by the
    OracleDictionary?
    Marc Prud'hommeaux wrote:
    Jan-
    That is odd ... Kodo should be identifying the foreign keys and ordering
    the statements accordingly. The mappings appear correct to me at first
    glance. If you run the "schemagen" tool, does Kodo correctly identify
    the foreign key constraints in the database? Can you post the output
    from the command so we can take a look?
    Jan-Esdert Franken wrote:
    Hi,
    i have problems with non-deferred foreing key constraints:
    I have a table "PERSON" and a table "ADRESSE" which has a foreign key
    to "PERSON". Both tables have primary keys with two columns.
    In the mappings I use application identity. The mappings are generated by
    xdoclet.
    We cannot use deferred constraint because we have to support following
    databases: Oracle, Firebird, MS SQL, DB2.
    I tested the mappings with Oracle and Firebird and got this exception
    (with SQL Trace):
    5602 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (1 errors)>
    [15 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 1, (String) [email protected], (String)
    04941 183742, (int) 12761, (int) 1, (int) 1, (String) 0171 2846751,
    (String) Oldenburg, (int) 12760, (String) 26129, (int) 1, (null) null,
    (String) Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=0]
    5602 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 3, (null) null, (null) null, (int) 12764,
    (int) 1, (int) 0, (null) null, (String) Sylt, (int) 12759, (String) 25980,
    (int) 0, (null) null, (String) Stephanstra__e 47, (String) 04651 19283]
    [reused=1]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 13390902 INSERT INTO VAMP.PERSON (ANREDEID, ID,
    KUNDENNR, LOESCHBEMERKUNG, MANDANTID, NAME1, NAME2, PERSONENDATUM,
    PERSONENORT, TYP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(null)
    null, (int) 12759, (String) 9999452800, (null) null, (int) 1, (String)
    Horstmann, (String) Manfred, (Timestamp) 1959-03-10 00:00:00.381, (String)
    Flensburg, (int) 1] [reused=0]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (2 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 1, (String) [email protected], (String)
    04941 183742, (int) 12763, (int) 1, (int) 1, (String) 0171 2846751,
    (String) Oldenburg, (int) 12759, (String) 26129, (int) 1, (null) null,
    (String) Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=2]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART,
    EMAIL, FAXNR, ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ,
    POSTADRESSE, POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?, ?, ?, ?, ?) [params=(int) 3, (null) null, (null) null, (int) 12762,
    (int) 1, (int) 0, (null) null, (String) Sylt, (int) 12760, (String) 25980,
    (int) 0, (null) null, (String) Stephanstra__e 47, (String) 04651 19283]
    [reused=3]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 13390902 INSERT INTO VAMP.PERSON (ANREDEID, ID,
    KUNDENNR, LOESCHBEMERKUNG, MANDANTID, NAME1, NAME2, PERSONENDATUM,
    PERSONENORT, TYP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(null)
    null, (int) 12760, (String) 9999452801, (null) null, (int) 1, (String)
    Horstmann, (String) Christine, (Timestamp) 1972-03-10 00:00:00.381,
    (String) Erfurt, (int) 1] [reused=1]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 11320634 INSERT INTO VAMP.NATPERSON
    (ANZAHLKINDER, ARBEITGEBERID, BEITRAGSSATZ, BERUFID, BRANCHEID,
    FAMILIENSTAND, FAMSTANDSEIT, FINANZAMTID, GEBIETSFREMDERAWG, GUETERSTAND,
    IDBEHOERDE, IDNR, KIRCHENSTEUER, KVID, MANDANTID, PERSONID, PRIVATKV,
    STAAT, STEUERBERATERID, STEUERKLASSE, STEUERNR, STEUERTARIF, TITEL) VALUES
    [params=(int) 0, (null) null, (double) 0.0, (null) null, (int) 12410,
    (int) 2, (Timestamp) 1991-12-12 00:00:00.381, (null) null, (int) 0, (int)
    3, (null) null, (null) null, (int) 0, (int) 12576, (int) 1, (int) 12760,
    (int) 0, (null) null, (null) null, (int) 0, (null) null, (int) 1, (null)
    null] [reused=0]
    5618 TRACE [main] kodo.jdbc.SQL - <t 26577913, conn 33108879 (3 errors)>
    [0 ms] executing prepstmnt 11320634 INSERT INTO VAMP.NATPERSON
    (ANZAHLKINDER, ARBEITGEBERID, BEITRAGSSATZ, BERUFID, BRANCHEID,
    FAMILIENSTAND, FAMSTANDSEIT, FINANZAMTID, GEBIETSFREMDERAWG, GUETERSTAND,
    IDBEHOERDE, IDNR, KIRCHENSTEUER, KVID, MANDANTID, PERSONID, PRIVATKV,
    STAAT, STEUERBERATERID, STEUERKLASSE, STEUERNR, STEUERTARIF, TITEL) VALUES
    [params=(int) 0, (null) null, (double) 0.0, (int) 12362, (int) 12378,
    (int) 2, (Timestamp) 1991-12-12 00:00:00.381, (null) null, (int) 0, (int)
    3, (null) null, (null) null, (int) 0, (int) 12576, (int) 1, (int) 12759,
    (int) 0, (null) null, (null) null, (int) 0, (null) null, (int) 1, (null)
    null] [reused=1]
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> [16 ms] rollback
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> return
    5634 TRACE [main] kodo.jdbc.JDBC - <t 26577913, conn 33108879 (3
    errors)> [0 ms] close
    com.solarmetric.jdbc.ReportingSQLException: ORA-02291: integrity
    constraint (VAMP.ADRESSE_PS) violated - parent key not found
    {prepstmnt 22511833 INSERT INTO VAMP.ADRESSE (ADRESSART, EMAIL, FAXNR,
    ID, MANDANTID, MELDEADRESSE, MOBILNR, ORT, PERSONID, PLZ, POSTADRESSE,
    POSTFACH, STRASSE, TELEFONNR) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
    ?, ?) [params=(int) 1, (String) [email protected], (String) 04941
    183742, (int) 12761, (int) 1, (int) 1, (String) 0171 2846751, (String)
    Oldenburg, (int) 12760, (String) 26129, (int) 1, (null) null, (String)
    Ammerl__nder Heerstra__e 19, (String) 04941 183740] [reused=0]} [code=2291,
    state=23000]
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:124)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.access$600(LoggingConnectionDecorator.java:19)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:728)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
    How can I force it to insert in the table "NATPERSON" first and then in
    the table "ADRESSE"?
    I use following JDBC-drivers:
    Firebird: 1.5.5
    Oracle: 9.2.0.1.0
    My property file:
    <!-- standard properties for all dbms -->
    <prop key="kodo.LicenseKey">LICENSE KEY REMOVED</prop>
    <prop key="kodo.ConnectionFactoryProperties">MaxCachedStatements=150,
    MaxActive=50, MaxIdle=50</prop>
    <prop key="kodo.FetchBatchSize">200</prop>
    <prop key="kodo.DataCache">true(CacheSize=5000)</prop>
    <prop key="kodo.RemoteCommitProvider">sjvm</prop>
    <prop key="kodo.jdbc.MappingFactory">metadata</prop>
    <prop key="kodo.jdbc.ForeignKeyConstraints">true</prop>
    <prop key="kodo.jdbc.SchemaFactory">native</prop>
    <prop
    key="javax.jdo.PersistenceManagerFactoryClass">kodo.jdbc.runtime.JDBCPersistenceManagerFactory</prop>
    <prop key="javax.jdo.option.Optimistic">true</prop>
    <!-- oracle connection properties -->
    <prop key="kodo.jdbc.DBDictionary">oracle</prop>
    <prop
    key="javax.jdo.option.ConnectionDriverName">oracle.jdbc.driver.OracleDriver</prop>
    <prop key="javax.jdo.option.ConnectionURL">..</prop>
    <prop key="javax.jdo.option.ConnectionUserName">..</prop>
    <prop key="javax.jdo.option.ConnectionPassword">..</prop>
    <prop key="kodo.jdbc.SequenceFactory">native</prop>
    <prop key="kodo.jdbc.Schemas">..</prop>
    <!-- firebird connection properties
    <prop key="kodo.jdbc.DBDictionary">kodo.jdbc.sql.FirebirdDictionary</prop>
    <prop
    key="javax.jdo.option.ConnectionDriverName">org.firebirdsql.jdbc.FBDriver</prop>
    <prop key="javax.jdo.option.ConnectionURL">..</prop>
    <prop key="javax.jdo.option.ConnectionUserName">..</prop>
    <prop key="javax.jdo.option.ConnectionPassword">..</prop>
    <prop key="kodo.jdbc.SequenceFactory">native(TableName=SYSDUAL,
    Format="SELECT GEN_ID(,1) FROM ")</prop>
    -->
    My database schema looks like this:
    TABLE PERSON
    FIELD MANDANTID (SMALLINT REQUIRED COMMENT (""))
    FIELD ID (AUTOINC COMMENT (""))
    FIELD TYP (SMALLINT REQUIRED COMMENT (""))
    FIELD KUNDENNR (CHAR(15) COMMENT ("Kundennummer"))
    PRIMARY KEY
    FIELD MANDANTID
    FIELD ID
    FOREIGN KEY MD
    TABLE MANDANT
    FIELD MANDANTID
    INDEX KDNR
    FIELD MANDANTID
    FIELD KUNDENNR
    UNIQUE
    TABLE ADRESSE
    FIELD MANDANTID (SMALLINT REQUIRED COMMENT (""))
    FIELD ID (AUTOINC COMMENT (""))
    FIELD PERSONID (LONGINT REQUIRED COMMENT (""))
    PRIMARY KEY
    FIELD MANDANTID
    FIELD ID
    FOREIGN KEY PS
    TABLE PERSON
    FIELD MANDANTID
    FIELD PERSONID
    My metadata looks like this:
    <class name="PersonDO"
    identity-type="application"
    objectid-class="com.elaxy.vamp.dom.person.PersonDOId"
    persistence-capable-superclass="com.elaxy.vamp.dom.AbstractDO">
    <extension vendor-name="kodo"
    key="jdbc-class-ind"
    value="metadata-value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-ind/column"
    value="TYP">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-ind-value"
    value="-1">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map"
    value="base">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map/table"
    value="PERSON">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map/column"
    value="ID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map/column"
    value="MANDANTID">
    </extension>
    <field name="kundenNr"
    persistence-modifier="persistent">
    </field>
    <field name="adressen"
    persistence-modifier="persistent">
    <collection
    element-type="com.elaxy.vamp.dom.person.AdresseDO">
    </collection>
    <extension vendor-name="kodo"
    key="jdbc-field-map"
    value="one-many">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.MANDANTID"
    value="MANDANTID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.ID"
    value="PERSONID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-map/table"
    value="ADRESSE">
    </extension>
    </field>
    .. fields ..
    </class>
    <class name="AdresseDO"
    identity-type="application"
    objectid-class="com.elaxy.vamp.dom.person.AdresseDOId"
    persistence-capable-superclass="com.elaxy.vamp.dom.AbstractDO">
    <extension vendor-name="kodo"
    key="jdbc-class-map"
    value="base">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-class-map/table"
    value="ADRESSE">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-sequence-name"
    value="ADRESSE_SEQ">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.id/jdbc-field-map/column"
    value="ID">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId"
    value="">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map"
    value="value">
    </extension>
    <extension vendor-name="kodo"
    key="jdbc-field-mappings/AbstractDO.mandantId/jdbc-field-map/column"
    value="MANDANTID">
    </extension>
    .. fields ..
    </class>
    Many thanks,
    Jan
    Marc Prud'hommeaux
    SolarMetric Inc.

  • REF TYPE 사용 예제

    제품 : SQL*PLUS
    작성날짜 : 2004-04-26
    REF TYPE 사용 예제
    =================
    . 오브젝트 reference 할 수 있는 값을 가지는 데이터 타입
    . 오브젝트와 오브젝트의 관계 표현에 유용
    < sample >
    -- object table 생성, data insert
    SQL> insert into address_tbl values ('55 Madison Ave', 'Madison',
    'WI', '53715') ;
    SQL> insert into address_tbl values (address('2 Avocet Drive',
    'Redwood Shores', 'CA', '95054' ));
    SQL> select value(p) from address_tbl p;
    ADDRESS('55 Madison Ave', 'Madison', 'WI', '53715')
    ADDRESS('2 Avocet Drive', 'Redwood Shores', 'CA', '95054')
    -- ref의 값을 특정 table로 제한
    SQL> create table address_ref_tbl
    ( empno number,
    address_ref ref address scope is address_tbl);
    -- Insert
    SQL> insert into address_ref_tbl
    select 10, ref(p) from address_tbl p where state = 'WI';
    SQL> insert into address_ref_tbl values (20, null);
    SQL> update address_ref_tbl
    set address_ref = (select ref(p) from address_tbl p
    where state = 'CA')
    where empno = 20 ;
    -- Select
    SQL> select * from address_ref_tbl;
    10 0000220208910A3F700F3811D3A2300010A4F93C83910A3F6F0F381 ....
    20 000220208910A3F710F3811D3A2300010A4F93C83910A3F6F0F3811 ...
    -- ref가 가리키는 object를 select
    SQL> select empno, deref(address_ref) from address_ref_tbl;
    10 ADDRESS('55 Madison Ave', 'Madison', 'WI', '53715')
    20 ADDRESS('2 Avocet Drive', 'Redwood Shores', 'CA', '95055')
    -- ref가 가리키는 object의 attribute를 select
    SQL> select p.address_ref.zip from address_ref_tbl p;
    53715
    95054
    -- reference하는 오브젝트의 값이 변한 경우 -> select 결과도 따라 변한다.
    SQL> update address_tbl set zip = '95055' where zip= 95054;
    SQL> select empno, deref(address_ref) from address_ref_tbl;
    10 ADDRESS('55 Madison Ave', 'Madison', 'WI', '53715')
    20 ADDRESS('2 Avocet Drive', 'Redwood Shores', 'CA', '95055')
    -- update
    SQL> update address_ref_tbl set address_ref =
    (select ref(p) from address_tbl p where zip ='95055')

    Suresh,
    In the same documentation you will find that,
    a REF points to a row with an OID column (system-generated or primary-key based). 'Dereferencing' a REF is accomplished by using simple dot notation. A user doesn't have to perform explicit join operation to access the referenced object.
    Regards,
    Geoff
    Dear Experts
    A REF is a logical "pointer" to a row object. It is an Oracle built-in datatype. REFs and collections of REFs model associations among objects--particularly many-to-one relationships--thus reducing the need for foreign keys.
    How the ref type can reduce the need for foreing keys.
    Could any body help in this regards with examples.
    Suresh

Maybe you are looking for