Unidirectional one-to-many with join table

According to http://docs.jboss.org/hibernate/orm/3.5/reference/en-US/html/associations.html#assoc-unidirectional-12m "A unidirectional one-to-many association on a foreign key is an unusual case, and is not recommended", instead they recommend using a join table, e.g.
create table Person ( personId bigint not null primary key )
create table PersonAddress ( personId not null, addressId bigint not null primary key )
create table Address ( addressId bigint not null primary key )
However if doing this, when using SQLDeveloper the Address table does not appear as a child table of Person, which it should be as a unidirectional one-to-many meaning that I can't create a cache group for Person and subsequently Person.
Is this something that can be worked around as I'm using a legacy schema created from Hibernate/JPA and the implications of changing are quite substantial?
Thanks

Hi Gennady,
Apologies but my question was not clear enough. The schema structure that I have inherited is as follows:
CREATE TABLE T_PERSON ( PERSONID NUMBER PRIMARY KEY, PERSONFIRSTNAME VARCHAR2(20), PERSONLASTNAME VARCHAR2(20) );
CREATE TABLE T_PERSONADDRESS (PERSONID NUMBER NOT NULL, ADDRESSID NUMBER NOT NULL PRIMARY KEY );
CREATE TABLE T_ADDRESS ( ADDRESSID NUMBER  PRIMARY KEY, ADDRESSTEXT VARCHAR2(200) );
ALTER TABLE T_PERSONADDRESS ADD CONSTRAINT FK_PERSON_ADDR_PERSON_ID FOREIGN KEY (PERSONID) REFERENCES T_PERSON(PERSONID);
ALTER TABLE T_PERSONADDRESS ADD CONSTRAINT FK_PERSON_ADDR_ADDR_ID FOREIGN KEY (ADDRESSID) REFERENCES T_ADDRESS(ADDRESSID);This is implementing a unidirectional one-to-many relationship between T_PERSON and T_ADDRESS according to the Hibernate and JPA recommendation. As far as I can see most schema designers would do this using by adding a column "PERSON_ID" (and associated FK) on the T_ADDRESS table and therefore not needing the T_PERSONADDRESS table.
This being what it is, I would then like to create a cache-group as follows:
CREATE READONLY CACHE GROUP "CACHEGROUPADDRESSES"
AUTOREFRESH MODE INCREMENTAL INTERVAL 5 MINUTES
STATE PAUSED
FROM
  "SCHEMA1"."T_PERSON" (
    "PERSONID"        NUMBER            NOT NULL,
    "PERSONFIRSTNAME" VARCHAR2(20 BYTE),
    "PERSONLASTNAME"  VARCHAR2(20 BYTE),
    PRIMARY KEY("PERSONID")
  "SCHEMA1"."T_ADDRESS" (
    "ADDRESSID" NUMBER NOT NULL,
    "ADDRESSTEXT" VARCHAR2(20 BYTE),
    PRIMARY KEY("ADDRESSID")
  "SCHEMA1"."T_PERSONADDRESS" (
    "PERSONID"  NUMBER NOT NULL,
    "ADDRESSID" NUMBER NOT NULL,
    PRIMARY KEY("ADDRESSID"),
    FOREIGN KEY("PERSONID")
      REFERENCES "SCHEMA1"."T_PERSON"("PERSONID"),
    FOREIGN KEY("ADDRESSID")
      REFERENCES "SCHEMA1"."T_ADDRESS"("ADDRESSID")
  )This however gives me the error "TT8222: Multiple parent tables found" because TimesTen has failed to identify the one-to-many-using-link-table pattern.
Without a schema re-write is there anything that I can do, alternatively will this be looked at for a future release of TimesTen?
Edited by: TrisStev on Apr 16, 2012 10:37 AM

Similar Messages

  • One to Many with multiple tables on One side and one table on Many side

    Sorry for the confusion in the title. Here is my question. In my program, I have 2 different tables which store 2 different type of entities. Each one of entities has a list of attachments which I stored in a common attachment table. There is a one-to-many relationship between entity tables and attachment table.
    ENTITY_ONE (
    ID
    NAME
    ENTITY_TWO (
    ID
    NAME
    ATTACHMENTS (
    ID
    ENTITY_ID
    ATTACHMENT_NAME
    ENTITY_ID in ATTACHMENTS table is used to link attachments to either entity one or entity two. All IDs are generated by one sequence. So they are always unique. My question is how I could map this relationship into EntityOne, EntityTwo and Attachment JAVA class?

    For EntityOne and EntityTwo you can just define a normal OneToMany mapping using the foreign key.
    Are you using JPA, or the TopLink API? JPA requires a mappedBy for the OneToMany, so this may be more difficult. You should be able to just add a JoinColumn on the OneToMany and make the column insertable/updateable=false.
    For the attachment, you could either map the foreign key as a Basic (DirectToFieldMapping) and maintain it in your model, or use a VariableOneToOne mapping in TopLink (this will require the entities share a common interface).
    James : http://www.eclipselink.org : http://en.wikibooks.org/wiki/Java_Persistence

  • Creating a single context index on a one-to-many and lookup table

    Hello,
    I've been successfully setting up text indexes on multiple columns on the same table (using MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a one-to-many data collection table (with a FK to a lookup table), and I need to search columns across both of these tables. Sample code below, more of my chattering after the code block:
    CREATE TABLE SUBMISSION
    ( SUBMISSION_ID             NUMBER(10)          NOT NULL,
      SUBMISSION_NAME           VARCHAR2(100)       NOT NULL
    CREATE TABLE ADVISOR_TYPE
    ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_NAME         VARCHAR2(50)        NOT NULL
    CREATE TABLE SUBMISSION_ADVISORS
    ( SUBMISSION_ADVISORS_ID    NUMBER(10)          NOT NULL,
      SUBMISSION_ID             NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      FIRST_NAME                VARCHAR(50)         NULL,
      LAST_NAME                 VARCHAR(50)         NULL,
      SUFFIX                    VARCHAR(20)         NULL
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (1, 'Some Research Paper');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (2, 'Thesis on 17th Century Weather Patterns');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (3, 'Statistical Analysis on Sunny Days in March');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (1, 'Department Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (2, 'Department Co-Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (3, 'Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (4, 'Associate Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (5, 'Scientist');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (1,1,2,'John', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (2,1,2,'Jane', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (3,2,3,'Johan', 'Smith', NULL);
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (4,2,4,'Magnus', 'Jackson', 'MS');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (5,3,5,'Williard', 'Forsberg', 'AMS');
    COMMIT;I want to be able to create a text index to lump these fields together:
    SUBMISSION_ADVISORS.FIRST_NAME
    SUBMISSION_ADVISORS.LAST_NAME
    SUBMISSION_ADVISORS.SUFFIX
    ADVISOR_TYPE.ADVISOR_TYPE_NAME
    I've looked at DETAIL_DATASTORE and USER_DATASTORE, but the examples in Oracle Docs for DETAIL_DATASTORE leave me a little bit perplexed. It seems like this should be pretty straightforward.
    Ideally, I'm trying to avoid creating new columns, and keeping the trigger adjustments to a minimum. But I'm open to any and all suggestions. Thanks for for your time and thoughts.
    -Jamie

    I would create a procedure that creates a virtual document with tags, which is what the multi_column_datatstore does behind the scenes. Then I would use that procedure in a user_datastore, so the result is the same for multiple tables as what a multi_column_datastore does for one table. I would also use either auto_section_group or some other type of section group, so that you can search using WITHIN as with the multi_column_datastore. Please see the demonstration below.
    SCOTT@orcl_11gR2> -- tables and data that you provided:
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION
      2  ( SUBMISSION_ID           NUMBER(10)          NOT NULL,
      3    SUBMISSION_NAME           VARCHAR2(100)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE ADVISOR_TYPE
      2  ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      3    ADVISOR_TYPE_NAME      VARCHAR2(50)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION_ADVISORS
      2  ( SUBMISSION_ADVISORS_ID      NUMBER(10)          NOT NULL,
      3    SUBMISSION_ID           NUMBER(10)          NOT NULL,
      4    ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      5    FIRST_NAME           VARCHAR(50)          NULL,
      6    LAST_NAME           VARCHAR(50)          NULL,
      7    SUFFIX                VARCHAR(20)          NULL
      8  )
      9  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      3    VALUES (1, 'Some Research Paper')
      4  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      5    VALUES (2, 'Thesis on 17th Century Weather Patterns')
      6  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      7    VALUES (3, 'Statistical Analysis on Sunny Days in March')
      8  SELECT * FROM DUAL
      9  /
    3 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      3    VALUES (1, 'Department Chair')
      4  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      5    VALUES (2, 'Department Co-Chair')
      6  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      7    VALUES (3, 'Professor')
      8  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      9    VALUES (4, 'Associate Professor')
    10  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
    11    VALUES (5, 'Scientist')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      3    VALUES (1,1,2,'John', 'Doe', 'PhD')
      4  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      5    VALUES (2,1,2,'Jane', 'Doe', 'PhD')
      6  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      7    VALUES (3,2,3,'Johan', 'Smith', NULL)
      8  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      9    VALUES (4,2,4,'Magnus', 'Jackson', 'MS')
    10  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
    11    VALUES (5,3,5,'Williard', 'Forsberg', 'AMS')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> -- constraints presumed based on your description:
    SCOTT@orcl_11gR2> ALTER TABLE submission ADD CONSTRAINT submission_id_pk
      2    PRIMARY KEY (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE advisor_type ADD CONSTRAINT advisor_type_id_pk
      2    PRIMARY KEY (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_advisors_id_pk
      2    PRIMARY KEY (submission_advisors_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_id_fk
      2    FOREIGN KEY (submission_id) REFERENCES submission (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT advisor_type_id_fk
      2    FOREIGN KEY (advisor_type_id) REFERENCES advisor_type (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> -- resulting data:
    SCOTT@orcl_11gR2> COLUMN submission_name FORMAT A45
    SCOTT@orcl_11gR2> COLUMN advisor      FORMAT A40
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  sa.advisor_type_id = a.advisor_type_id
    10  AND    sa.submission_id = s.submission_id
    11  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    Statistical Analysis on Sunny Days in March   Scientist Williard Forsberg AMS
    5 rows selected.
    SCOTT@orcl_11gR2> -- procedure to create virtual documents:
    SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE submission_advisors_proc
      2    (p_rowid IN           ROWID,
      3       p_clob     IN OUT NOCOPY CLOB)
      4  AS
      5  BEGIN
      6    FOR r1 IN
      7        (SELECT *
      8         FROM      submission_advisors
      9         WHERE  ROWID = p_rowid)
    10    LOOP
    11        IF r1.first_name IS NOT NULL THEN
    12          DBMS_LOB.WRITEAPPEND (p_clob, 12, '<first_name>');
    13          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.first_name), r1.first_name);
    14          DBMS_LOB.WRITEAPPEND (p_clob, 13, '</first_name>');
    15        END IF;
    16        IF r1.last_name IS NOT NULL THEN
    17          DBMS_LOB.WRITEAPPEND (p_clob, 11, '<last_name>');
    18          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.last_name), r1.last_name);
    19          DBMS_LOB.WRITEAPPEND (p_clob, 12, '</last_name>');
    20        END IF;
    21        IF r1.suffix IS NOT NULL THEN
    22          DBMS_LOB.WRITEAPPEND (p_clob, 8, '<suffix>');
    23          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.suffix), r1.suffix);
    24          DBMS_LOB.WRITEAPPEND (p_clob, 9, '</suffix>');
    25        END IF;
    26        FOR r2 IN
    27          (SELECT *
    28           FROM   submission
    29           WHERE  submission_id = r1.submission_id)
    30        LOOP
    31          DBMS_LOB.WRITEAPPEND (p_clob, 17, '<submission_name>');
    32          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r2.submission_name), r2.submission_name);
    33          DBMS_LOB.WRITEAPPEND (p_clob, 18, '</submission_name>');
    34        END LOOP;
    35        FOR r3 IN
    36          (SELECT *
    37           FROM   advisor_type
    38           WHERE  advisor_type_id = r1.advisor_type_id)
    39        LOOP
    40          DBMS_LOB.WRITEAPPEND (p_clob, 19, '<advisor_type_name>');
    41          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r3.advisor_type_name), r3.advisor_type_name);
    42          DBMS_LOB.WRITEAPPEND (p_clob, 20, '</advisor_type_name>');
    43        END LOOP;
    44    END LOOP;
    45  END submission_advisors_proc;
    46  /
    Procedure created.
    SCOTT@orcl_11gR2> SHOW ERRORS
    No errors.
    SCOTT@orcl_11gR2> -- examples of virtual documents that procedure creates:
    SCOTT@orcl_11gR2> DECLARE
      2    v_clob  CLOB := EMPTY_CLOB();
      3  BEGIN
      4    FOR r IN
      5        (SELECT ROWID rid FROM submission_advisors)
      6    LOOP
      7        DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
      8        submission_advisors_proc (r.rid, v_clob);
      9        DBMS_OUTPUT.PUT_LINE (v_clob);
    10        DBMS_LOB.FREETEMPORARY (v_clob);
    11    END LOOP;
    12  END;
    13  /
    <first_name>John</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Jane</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Johan</first_name><last_name>Smith</last_name><submission_name>Thesis on 17th Century
    Weather Patterns</submission_name><advisor_type_name>Professor</advisor_type_name>
    <first_name>Magnus</first_name><last_name>Jackson</last_name><suffix>MS</suffix><submission_name>The
    sis on 17th Century Weather Patterns</submission_name><advisor_type_name>Associate
    Professor</advisor_type_name>
    <first_name>Williard</first_name><last_name>Forsberg</last_name><suffix>AMS</suffix><submission_name
    Statistical Analysis on Sunny Days inMarch</submission_name><advisor_type_name>Scientist</advisor_type_name>
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- user_datastore that uses procedure:
    SCOTT@orcl_11gR2> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('sa_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE ('sa_datastore', 'PROCEDURE', 'submission_advisors_proc');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- index (on optional extra column) that uses user_datastore and section group:
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD (any_column VARCHAR2(1))
      2  /
    Table altered.
    SCOTT@orcl_11gR2> CREATE INDEX submission_advisors_idx
      2  ON submission_advisors (any_column)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  PARAMETERS
      5    ('DATASTORE     sa_datastore
      6        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP')
      7  /
    Index created.
    SCOTT@orcl_11gR2> -- what is tokenized, indexed, and searchable:
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$submission_advisors_idx$i
      2  /
    TOKEN_TEXT
    17TH
    ADVISOR_TYPE_NAME
    AMS
    ANALYSIS
    ASSOCIATE
    CENTURY
    CHAIR
    CO
    DAYS
    DEPARTMENT
    DOE
    FIRST_NAME
    FORSBERG
    JACKSON
    JANE
    JOHAN
    JOHN
    LAST_NAME
    MAGNUS
    MARCH
    PAPER
    PATTERNS
    PHD
    PROFESSOR
    RESEARCH
    SCIENTIST
    SMITH
    STATISTICAL
    SUBMISSION_NAME
    SUFFIX
    SUNNY
    THESIS
    WEATHER
    WILLIARD
    34 rows selected.
    SCOTT@orcl_11gR2> -- sample searches across all data:
    SCOTT@orcl_11gR2> VARIABLE search_string VARCHAR2(100)
    SCOTT@orcl_11gR2> EXEC :search_string := 'professor'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string) > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'doe'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'paper'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> -- sample searches within specific columns:
    SCOTT@orcl_11gR2> EXEC :search_string := 'chair'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN advisor_type_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'phd'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN suffix') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'weather'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN submission_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.

  • Unidirectional one-to-many relationship without a join table

    Hello,
    I have 2 classes, Invoice and InvoiceLine, and a one-to-many unidirectional relationship from Invoice to InvoiceLine. By default, with JPA, it would be mapped by a join table with foreign keys that refer to the 2 tables which represent Invoice and InvoiceLine.
    My problem: the database has already a foreign key in the table which represents InvoiceLine that refers to the table which represents Invoice.
    To solve my problem I could make the relationship bidirectional but I would like to know if it is possible to keep it unidirectional and to use the foreign key which already exists (in the table that represents InvoiceLine). How could I declare the mapping with JPA?
    Thanks in avance for your answers.

    JPA requires that any @OneToMany mapping not using a join table have an inverse @ManyToOne mapping. In general the foreign key in the target object needs to be mapped and a @ManyToOne mapping is normally the best way to map it, so making the relationship bi-directional is your best option.
    There are other ways in TopLink to map a unidirectional 1-m, but these are not directly supported by the JPA spec. You could define a TopLink OneToManyMapping for the relationship through a TopLink DescriptorCustomizer and the code API. You would still need to map the foreign key in the target object some way, but you could use a @Basic mapping for this as long as you keep it in synch.
    In TopLink you could also map the relationship using an AggregateCollectionMapping (basically a collection of embeddables), and then not require mapping the foreign key in the target, but this imposes limitations on the target object (must be treated like an embeddable instead of entity). You would also need to configure the target object to be an aggregateCollectionDescriptor if using this option.

  • Named query with join tables

    I have two tables
    - Process_Master (EVENT_ID, EVENT_TYP, STATUS)
    - Rel_Event( EVENT_ID, USERID, EVENT_DATE, RMKS)
    They have one-to-one relationship linked by EVENT_ID.
    I would like to create a named query like below joining 2 tables together.
    Do I need to create any class descriptor first and how? I want this query to be available from the ADF data control so I can drag and drop this to my JSP page as a ADF table. I have no problem in working with single table. I have read thru the developer guide and try out many things like multitable info, aggregate mapping and couldn't figure out how this can be done. Please help!!!
    SELECT A.EVENT_ID,B.EVENT_DATE, A.STATUS, B.RMKS
    FROM PROCESS_MASTER A, REL_EVENT B
    WHERE A.EVENT_ID = B.EVENT_ID
    AND A.STATUS = 'P';
    ********/

    I have tried the below but fail to retrieve any rows. Please help!
    Expression aid = new ExpressionBuilder(ProcEventMaster.class).get("event_id");
    Expression bid = new ExpressionBuilder(RelEvent.class).get("event_id");
    ReportQuery reportQuery = new ReportQuery(ProcEventMaster.class,aid.equal(bid));
    reportQuery.addAttribute("a_id", aid);
    reportQuery.addAttribute("b_id", bid);
    reportQuery.addAttribute("eventDate",bid.get("event_date"));
    reportQuery.addAttribute("remarks",bid.get("rmks"));
    reportQuery.setSelectionCriteria(aid.get("status").equal("P"));
    List<RelEvent> results =
    (List<RelEvent>)session.executeQuery(reportQuery);session.release();
    return results;

  • One-to-many with subclasses

    Hello again,
    there seems to be a problem with one-to-many relations involving
    inheritence...
    Let me describe the setting:
    class AbstractUsecase {
    // element-type=Account
    Set accounts;
    class Usecase extends AbstractUsecase {
    class Account extends AbstractAccount implements InstanceCallbacks {
    // element-type=AccountRevisionItem
    List revisions;
    AbstractUsecase uc;
    class AccountRevisionItem extends Account {
    long time;
    User user;
    As you can see a simple model (in uml it looks much more better).
    In the method jdoPreStore() of Account an object of type
    AccountRevisionItem will added to revisions. This new object holds the
    data of Account, the User and timestamp of the modifing. So we are able to
    trace every change on the date (user, date). Metadata looks like this:
    <class name="AbstractUsecase"/>
    <class name="Usecase" persistence-capable-superclass="AbstractUsecase">
    <class name="Abstractaccount"/>
    <class name="Account" persistence-capable-superclass="AbstractAccount">
    <extension vendor-name="kodo" key="table" value="Account"/>
    <field name="revisions">
    <collection element-type="AccountRevisionItem"/>
    </field>
    </class>
    <class name="AccountRevisionItem"
    persistence-capable-superclass="Account"/>
    When i get a extent of all Accounts i can fetch all revisions of each
    Account.
    Now the problem: When i fetch all accounts of a usecase there are objects
    included of type Account AND AccountRevisionItem. The generated SQL code
    shows also why: ...t0.JDOCLASSX IN ('tolina.data.Account',
    'tolina.data.AccountRevisionItem')...
    Kodo tries when fetching a set of Accounts also all subclasses of
    Accounts! How can i say: this set contains only accounts and no fetching
    of subclasses is needed!
    I would be grateful for any help!
    PS: I noticed that kodo deletes all elements of a list when inserting a
    new element, i remember there a several faqs around this. Can you anyway
    give a work-a-round?

    Hi Patrick,
    i found my mistake: in the copy() method of AccountRevisionItem which
    copies the attributes of the Accountobject, i copied the Usecase reference
    too.
    So when all Accounts of a usecase will be fetched the copied
    AccountRevisionItem matched too, because of the fk of the usecase :[
    I was wondering why i get the RevisionItem although i never added it to
    the list of accounts in the usecase - now i know :)
    Your strategy to fetch all objects of the desired class AND subclass when
    traverse a relation is of course right. But can i control it like in the
    case from extents?
    Your proposal to use sets instead of lists is not really the solution,
    because sets have no order of the containing elements!
    I have to life with sets because deleting all elements when inserting a
    new one is not really performant...
    Thanks anyway for your quick help!
    I promise this was not the last time, because we will use kodo in a
    prototyp-project - when it will be a success we will buy kodo.
    Patrick Linskey wrote:
    How are you getting the extent? If you do:
    Extent e = pm.getExtent (Account.class, true);
    you will get all subclasses. If you do:
    Extent e = pm.getExtent (Account.class, false);
    then you will get an extent of just Account objects -- no subclasses.
    Now, if you're traversing a relation, we will always return all objects
    in that relation, regardless of subclass. So, if you have a one-many
    relation from UseCase to Account, we'll return all objects in that
    relation. However, that relation should only contain data that you put
    into it, so if you never put anything but Account objects into it, then
    you should not see anything else come out.
    Regarding your collection question -- if you declare the field as a
    java.util.Set, modifications of the collection will be much more efficient.
    -Patrick
    Claudius Gr__ver wrote:
    Hello again,
    there seems to be a problem with one-to-many relations involving
    inheritence...
    Let me describe the setting:
    class AbstractUsecase {
    // element-type=Account
    Set accounts;
    class Usecase extends AbstractUsecase {
    class Account extends AbstractAccount implements InstanceCallbacks {
    // element-type=AccountRevisionItem
    List revisions;
    AbstractUsecase uc;
    class AccountRevisionItem extends Account {
    long time;
    User user;
    As you can see a simple model (in uml it looks much more better).
    In the method jdoPreStore() of Account an object of type
    AccountRevisionItem will added to revisions. This new object holds the
    data of Account, the User and timestamp of the modifing. So we are able to
    trace every change on the date (user, date). Metadata looks like this:
    When i get a extent of all Accounts i can fetch all revisions of each
    Account.
    Now the problem: When i fetch all accounts of a usecase there are objects
    included of type Account AND AccountRevisionItem. The generated SQL code
    shows also why: ...t0.JDOCLASSX IN ('tolina.data.Account',
    'tolina.data.AccountRevisionItem')...
    Kodo tries when fetching a set of Accounts also all subclasses of
    Accounts! How can i say: this set contains only accounts and no fetching
    of subclasses is needed!
    I would be grateful for any help!
    PS: I noticed that kodo deletes all elements of a list when inserting a
    new element, i remember there a several faqs around this. Can you anyway
    give a work-a-round?
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • ONE-to-MANY relationship between tables and forms in APEX

    I recently started using APEX and I have run into an issue.
    I have a ONE-TO-MANY relationship between two tables, A1 and A2, respectively.
    A1:
    A1_ID
    Item
    A2:
    A2_ID
    SubItem
    A1_ID
    I have 2 forms (lets call it F1 and F2) that I use to capture data for A1 and A2.
    On F2, I have the following fields that are setup to capture data:
         A2.A1_ID
    **A1.Item (this is a drop down that is populated using a SELECT statement where the select uses A1.Item field)
         A2.SubItem (user would enter SubItem)
    Note: A2.A2_ID is populated using a SEQ
    Everytime I pick **A1.Item on F2, is there a way to link to A1 table and display A1.A1_ID for every **A1.Item selected on F2?
    If so, I want to store the value captured in F2 for the A1_ID field into A2 table to maintain my 1-to-MANY relationship.
    If this will work, how do I go about implementing this solution?
    Can someone help me?

    I think it sounds like you are asking for a Master-Detail form. Try that and see what you get.
    chris.

  • Problem with joining tables in cmp bean

    This is for an informix database. when i specify to join tables in CMP beans i get a sql error.. this is what the SQL join statement looks like when the server spits it out:
    SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer drs_category t1 ON t0.style=t1.style WHERE t0.available = 'T'
    it puts the "ON" string into the join?? this gives me a SQL error, it's supposed to be like this:
    SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer join drs_category t1 WHERE t0.style=t1.style AND t0.available = 'T'
    how can i fix this

    nevermind..i figured it out again.. in the INFORMIX DYNAMIC SERVER.properties file replace the left join attribute with this:
    LEFT_JOIN= left join
    make sure there is a space before the "l" in left and a space after the "n" in join, otherwise it will be a sql error:
    the previously LEFT_JOIN=, outer statement is clearly wrong for this database.

  • OR mapping one-to-many with the movie EJB application

    Hi,
    I have downloaded from Orion the Movie EJB application with
    OR mapping one-to-many.
    When I ran it, it's fine. But I have spurious messages on
    my OC4J LOG:
    Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
    java.lang.Exception
    at MovieHome_EntityHomeWrapper53.getLazyInstance(MovieHome_EntityHomeWrapper53.java:219)
    at Movie_ORCollection29.getObjects(Movie_ORCollection29.java:43)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at java.util.ArrayList.<init>(ArrayList.java:125)
    at com.evermind.server.ejb.ORCollection.getReplacement(ORCollection.java:22)
    at Director_EntityBeanWrapper1.getMovies(Director_EntityBeanWrapper1.java:1318)
    at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at MovieHome_EntityHomeWrapper53.getLazyInstance(MovieHome_EntityHomeWrapper53.java:219)
    at Movie_ORCollection29.getObjects(Movie_ORCollection29.java:43)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at java.util.ArrayList.<init>(ArrayList.java:125)
    at com.evermind.server.ejb.ORCollection.getReplacement(ORCollection.java:22)
    at Director_EntityBeanWrapper1.getMovies(Director_EntityBeanWrapper1.java:1318)
    at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper28.getLazyInstance(DirectorHome_EntityHomeWrapper28.java:207)
    at Movie_EntityBeanWrapper3.loadState(Movie_EntityBeanWrapper3.java:1575)
    at Movie_EntityBeanWrapper3.getTitle(Movie_EntityBeanWrapper3.java:1374) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper28.getLazyInstance(DirectorHome_EntityHomeWrapper28.java:207)
    at Movie_EntityBeanWrapper3.loadState(Movie_EntityBeanWrapper3.java:1575)
    at Movie_EntityBeanWrapper3.getTitle(Movie_EntityBeanWrapper3.java:1374) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    Auto-unpacking /u00/app/oracle/product/9i/j2ee/home/applications/MovieDatabase.ear... done.
    Auto-unpacking /u00/app/oracle/product/9i/j2ee/home/applications/MovieDatabase/MovieDatabaseWebClient.war... done.
    Auto-deploying MovieDatabaseBeans.jar (Class 'moviebeans.Actor' had been updated)... done.
    java.lang.Exception
    at ActorHome_EntityHomeWrapper9.getLazyInstance(ActorHome_EntityHomeWrapper9.java:207)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:49)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at MovieHome_EntityHomeWrapper57.getLazyInstance(MovieHome_EntityHomeWrapper57.java:219)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:69)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at MovieActorJunctureHome_EntityHomeWrapper39.getLazyInstance(MovieActorJunctureHome_EntityHomeWrapper39.java:216)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:86)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper32.getLazyInstance(DirectorHome_EntityHomeWrapper32.java:207)
    at Movie_EntityBeanWrapper7.loadState(Movie_EntityBeanWrapper7.java:1575)
    at MovieHome_EntityHomeWrapper57.findExistingEntity(MovieHome_EntityHomeWrapper57.java:108)
    at MovieHome_EntityHomeWrapper57.activateEntity(MovieHome_EntityHomeWrapper57.java:157)
    at MovieHome_EntityHomeWrapper57.findByPrimaryKey(MovieHome_EntityHomeWrapper57.java:359)
    at MovieHome_EntityHomeWrapper57.getEJBObject(MovieHome_EntityHomeWrapper57.java:213)
    at com.evermind.server.ejb.EntityHandle.getEJBObject(EntityHandle.java:53)
    at com.evermind.server.ejb.EJBInputStream.resolveObject(EJBInputStream.java:41)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:405)
    at java.io.ObjectInputStream.inputArray(ObjectInputStream.java:1148)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:380)
    at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2268)
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:525)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1417)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:392)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242)
    at com.evermind.server.ejb.EJBUtils.cloneObject(EJBUtils.java:346)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:1075)
    at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper32.getLazyInstance(DirectorHome_EntityHomeWrapper32.java:207)
    at Movie_EntityBeanWrapper7.loadState(Movie_EntityBeanWrapper7.java:1575)
    at Movie_EntityBeanWrapper7.getTitle(Movie_EntityBeanWrapper7.java:1374) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    Auto-unpacking /u00/app/oracle/product/9i/j2ee/home/applications/MovieDatabase.ear... done.
    java.lang.Exception
    at ActorHome_EntityHomeWrapper9.getLazyInstance(ActorHome_EntityHomeWrapper9.java:207)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:49)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at MovieHome_EntityHomeWrapper57.getLazyInstance(MovieHome_EntityHomeWrapper57.java:219)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:69)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at MovieActorJunctureHome_EntityHomeWrapper39.getLazyInstance(MovieActorJunctureHome_EntityHomeWrapper39.java:216)
    at MovieActorJuncture_ORCollection10.getObjects(MovieActorJuncture_ORCollection10.java:86)
    at com.evermind.server.ejb.ORCollection.size(ORCollection.java:42)
    at moviebeans.ActorBean.getMovies(Unknown Source)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:983) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper32.getLazyInstance(DirectorHome_EntityHomeWrapper32.java:207)
    at Movie_EntityBeanWrapper7.loadState(Movie_EntityBeanWrapper7.java:1575)
    at MovieHome_EntityHomeWrapper57.findExistingEntity(MovieHome_EntityHomeWrapper57.java:108)
    at MovieHome_EntityHomeWrapper57.activateEntity(MovieHome_EntityHomeWrapper57.java:157)
    at MovieHome_EntityHomeWrapper57.findByPrimaryKey(MovieHome_EntityHomeWrapper57.java:359)
    at MovieHome_EntityHomeWrapper57.getEJBObject(MovieHome_EntityHomeWrapper57.java:213)
    at com.evermind.server.ejb.EntityHandle.getEJBObject(EntityHandle.java:53)
    at com.evermind.server.ejb.EJBInputStream.resolveObject(EJBInputStream.java:41)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:405)
    at java.io.ObjectInputStream.inputArray(ObjectInputStream.java:1148)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:380)
    at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2268)
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:525)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1417)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:392)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242)
    at com.evermind.server.ejb.EJBUtils.cloneObject(EJBUtils.java:346)
    at Actor_EntityBeanWrapper4.getMovies(Actor_EntityBeanWrapper4.java:1075)
    at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    java.lang.Exception
    at DirectorHome_EntityHomeWrapper32.getLazyInstance(DirectorHome_EntityHomeWrapper32.java:207)
    at Movie_EntityBeanWrapper7.loadState(Movie_EntityBeanWrapper7.java:1575)
    at Movie_EntityBeanWrapper7.getTitle(Movie_EntityBeanWrapper7.java:1374) at webclient.MovieDatabaseServlet.processQueryRequest(Unknown Source)
    at webclient.MovieDatabaseServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)

    For EntityOne and EntityTwo you can just define a normal OneToMany mapping using the foreign key.
    Are you using JPA, or the TopLink API? JPA requires a mappedBy for the OneToMany, so this may be more difficult. You should be able to just add a JoinColumn on the OneToMany and make the column insertable/updateable=false.
    For the attachment, you could either map the foreign key as a Basic (DirectToFieldMapping) and maintain it in your model, or use a VariableOneToOne mapping in TopLink (this will require the entities share a common interface).
    James : http://www.eclipselink.org : http://en.wikibooks.org/wiki/Java_Persistence

  • Help with joining tables

    hello can some one help me in joining the tables
    po_vendors of AP and gl_je_headers or gl_he_headers of GL
    thankyou

    How about this:
    Build first an auxiliary table (you can truncate it every time) and in it:
    create table auxtab as
    select distinct employeeid, row_date from table1
    union
    select distinct employeeid, row_date from table2
    union
    select distinct employeeid, row_date from table3
    union
    Then you can use this "auxiliar" table as the driving one for outer joins
    select * from auxtab left outer join table1 on ()
    left outer join table2 on ()
    left outer join table3 on ()
    etc..

  • One-to-many outer join in MView, is possible?

    Re: 10g R2
    Is it simply not possible to have fast refresh on outer joins that are 1-to-many relations? I have in this script a unique key addition to "fix" it, but it restricts something that I don't want restricted. If indeed this is how it should work, are there any strategies for improving performance for queries on this type of thing? The "fact_table" in this example is actually another materialized view with simple inner joins, so that works perfectly, but I was trying to improve query performance in this case too.
    Run the script w/ dbms output...all self contained within the schema.
    drop materialized view log on fact_Table;
    drop materialized view log on outer_detail;
    drop materialized view mview_test;
    drop table outer_detail cascade constraints;
    drop table fact_Table cascade constraints;
    create table fact_table (myid number primary key, fact_attrib varchar2(10));
    create table outer_detail (myid number primary key, outer_attrib varchar2(19), fact_table_id number, constraint fk_outer_to_Fact foreign key (fact_table_id) references fact_table(myid));
    CREATE MATERIALIZED VIEW LOG ON fact_table WITH ROWID;
    CREATE MATERIALIZED VIEW LOG ON outer_detail WITH ROWID;
    declare
        v_capabilities sys.ExplainMVArrayType ;
    begin
        dbms_mview.explain_mview('SELECT ft.rowid "ftrid", ' ||
           'od.rowid "odrid", ' ||
           'ft.myid fact_id, ' ||
           'od.myid outer_id, ' ||
           'ft.fact_attrib, ' ||
           'od.outer_attrib ' ||
      'FROM fact_table ft, outer_detail od ' ||
    'WHERE ft.myid = od.fact_table_id (+)', v_capabilities);
            dbms_output.put_line('ATTEMPT 1:');
            dbms_output.put_line('==============================================');
        for v_capability in (select capability_name, possible, related_text, msgtxt from table (v_capabilities))
        loop
            dbms_output.put_line('==============================================');
            dbms_output.put_line('==============================================');
            dbms_output.put_line(v_capability.capability_name);
            dbms_output.put_line(v_capability.possible);
            dbms_output.put_line(v_capability.related_text);
            dbms_output.put_line(v_capability.msgtxt);
        end loop;
    end;
    /*CREATE MATERIALIZED VIEW mview_test
    PARALLEL BUILD IMMEDIATE
    REFRESH FAST ON COMMIT WITH ROWID
    AS
    SELECT ft.rowid "ftrid",
           od.rowid "odrid",
           ft.myid fact_id,
           od.myid outer_id,
           ft.fact_attrib,
           od.outer_attrib
      FROM fact_table ft, outer_detail od
    WHERE ft.myid = od.fact_table_id (+);
    -- I'd like it to run without this constraint, is it not possible?
    alter table outer_detail add constraint unk_outer_detail unique (fact_table_id);
    declare
        v_capabilities sys.ExplainMVArrayType ;
    begin
        dbms_mview.explain_mview('SELECT ft.rowid "ftrid", ' ||
           'od.rowid "odrid", ' ||
           'ft.myid fact_id, ' ||
           'od.myid outer_id, ' ||
           'ft.fact_attrib, ' ||
           'od.outer_attrib ' ||
      'FROM fact_table ft, outer_detail od ' ||
    'WHERE ft.myid = od.fact_table_id (+)', v_capabilities);
            dbms_output.put_line('');
            dbms_output.put_line('');
            dbms_output.put_line('');
            dbms_output.put_line('ATTEMPT 2:');
            dbms_output.put_line('==============================================');
        for v_capability in (select capability_name, possible, related_text, msgtxt from table (v_capabilities))
        loop
            dbms_output.put_line('==============================================');
            dbms_output.put_line('==============================================');
            dbms_output.put_line(v_capability.capability_name);
            dbms_output.put_line(v_capability.possible);
            dbms_output.put_line(v_capability.related_text);
            dbms_output.put_line(v_capability.msgtxt);
        end loop;
    end;
    /Edited by: ORA-01435 on Sep 30, 2009 12:54 PM

    That's what I thought too. As far as I'm concerned, this is perfectly acceptable. Of course I'm in 10g R2, but:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/basicmv.htm#sthref534
    I keep re-reading the rules, trying to see why it thinks I'm violating one of them. Might have to meta-link this one.
    Just ran this on a different box, ran fine. Seem to have configuration issues between the boxes.
    Edit: Just determined that the boxes that this doesn't work on have Oracle parameters for compatibility set to 10.1.0.2.0, I'll change them and check if it modifies behavior
    Edited by: ORA-01435 on Oct 1, 2009 7:44 AM

  • Unidirectional one-to-many CMR in OC4J 9.0.3.1699

    Hi,
    I have the following issue with the new (productiv) OC4J 9.0.3 build 020927.1699, with did not occur with
    build 020725.1695. I would like to deploy local entity beans CMRDepartment -1--n-> CMREmployee with container managed relations. Here's the relation part of ejb-jar.xml
    <ejb-relation>
    <ejb-relation-name>theEmployees2theDepartment</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>theEmployees</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>CMREmployee</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>theDepartment</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>CMRDepartment</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>theEmployees</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now the problem is that the depoyment generates an database table CMREmployee_cmrtest_cmrtest for CMR with a foreign key column CMRDepartment_theEmployees referencing the CMRDepartment_cmrtest_cmrtest table for the CMRDepartment bean, even though the relation is not navigable from Emp to Dept. Is this a bug or a feature? Here's the CMREmployee part of the orion-ejb-jar.xml after deployment:
              <entity-deployment name="CMREmployee" location="CMREmployee" wrapper="CMREmployeeHome_EntityHomeWrapper27" local-wrapper="CMREmployeeLocalHome_EntityHomeWrapper16" table="CMREmployee_cmrtest_cmrtest" data-source="jdbc/OracleDS" exclusive-write-access="false" locking-mode="optimistic" update-changed-fields-only="true" delay-updates-until-commit="true" min-instances-per-pk="0" max-instances-per-pk="50" disable-wrapper-cache="true">
                   <primkey-mapping>
                        <cmp-field-mapping name="id" persistence-name="id" />
                   </primkey-mapping>
                   <cmp-field-mapping name="name" persistence-name="name" />
                   <cmp-field-mapping name="theAddress">
                        <entity-ref home="CMRAddress">
                             <cmp-field-mapping name="theAddress" persistence-name="theAddress" />
                        </entity-ref>
                   </cmp-field-mapping>
                   <cmp-field-mapping name="CMRDepartment_theEmployees">
                        <entity-ref home="CMRDepartment">
                             <cmp-field-mapping name="CMRDepartment_theEmployees" persistence-name="CMRDepartment_theEmployees" />
                        </entity-ref>
                   </cmp-field-mapping>
                   <cmp-field-mapping name="theProjects">
                        <collection-mapping table="CMRProject_CMREmployee__1ftrph">
                             <primkey-mapping>
                                  <cmp-field-mapping name="CMREmployee_id">
                                       <entity-ref home="CMREmployee">
                                            <cmp-field-mapping name="CMREmployee_id" persistence-name="CMREmployee_id" />
                                       </entity-ref>
                                  </cmp-field-mapping>
                             </primkey-mapping>
                             <value-mapping type="cmrtest.CMRProjectLocal">
                                  <cmp-field-mapping name="CMRProject_id">
                                       <entity-ref home="CMRProject">
                                            <cmp-field-mapping name="CMRProject_id" persistence-name="CMRProject_id" />
                                       </entity-ref>
                                  </cmp-field-mapping>
                             </value-mapping>
                        </collection-mapping>
                   </cmp-field-mapping>
                   <finder-method>
                        <!-- Generated SQL: "SELECT o.id FROM CMREmployee_cmrtest_cmrtest o -->
                        <method>
                             <ejb-name>CMREmployee</ejb-name>
                             <method-name>findAllInstances</method-name>
                             <method-params>
                             </method-params>
                        </method>
                   </finder-method>
                   <ejb-ref-mapping name="ejb/references/theAddress/CMRAddressLocal" />
                   <ejb-ref-mapping name="ejb/references/theProjects/CMRProjectLocal" />
                   <resource-ref-mapping name="jdbc/EJBDataSource" />
                   <resource-ref-mapping name="jms/EJBQueueConnectionFactory" />
                   <resource-ref-mapping name="jms/EJBTopicConnectionFactory" />
                   <resource-env-ref-mapping name="jms/EJBQueue" />
                   <resource-env-ref-mapping name="jms/EJBTopic" />
              </entity-deployment>
    Any hints would be very wellcome.
    Regards
    Stefan

    Trond,
    when ou deploy your application, you should not need to include the orion-ejb-jar.xml.
    Also, if you have previously deployed the application, delete the application directory UNDER both applicatopn-deployments and applications. The directory will be your application's name.
    Hope this helps,
    Rob Cole
    Oracle

  • How to deal with Join Table in SAP Query

    Hi buddy,
    I create a Infoset ZTest by some infotype, one of them is 0185, and 3208.
    In 0185 there is a ICTYP and 3208 also SUBTY, and they are Join by that fields.
    It means, add a new record in P0185 with ICTYP = 'RS', there is a new record add in P3208 automaticly.
    Now, in my SAPQuery, I just need to input a ICTYP, and select the result. It always have unnessary records in output.
    Fg.  in P0185 have two records, ICTYP are 'RS', 'FR', so, in P3208 also have.
    And input 'RS' as input selction paramters, it check the records which ICYTP is RS in P0185, but it won't do the check in P3208, because, in selction screen, it just have P0185-ICTYP.
    So, the output will have problem.
    I want to know how to fix this issue, or add some extra code in the SAPQuery....
    Really thanks .

    hi,
    The pdf below gives the steps to create drill down report.
    http://www.sappoint.com/abap/eis.pdf
    also check.
    <a href="http://72.14.203.104/search?q=cache:k-SFYy_rjPIJ:www.hrexpertonline.com/archive/Volume%252003%2520(2">http://72.14.203.104/search?q=cache:k-SFYy_rjPIJ:www.hrexpertonline.com/archive/Volume%252003%2520(2</a>
    regs,
    jaga

  • Select Problem with Joined tables

    Hello everyone I have the following Query
    SELECT
        OBJEKTI.OBJEKAT_ID OBJEKAT_ID,
        OBJEKTI.ADRESA ADRESA,
        OBJEKTI.POVRSINA POVRSINA,
        OBJEKTI.BROJ_IZVRSILACA BROJ_IZVRSILACA,
        OPREMLJENOSTI.OPREMLJENOST_ID OPREMLJENOST_ID,
        OPREMLJENOSTI.PULT PULT,
        OPREMLJENOSTI.REKLAMA REKLAMA,
        OPREMLJENOSTI.MOKRI_CVOR MOKRI_CVOR,
        OPREMLJENOSTI.WC_ZA_IGRACE WC_ZA_IGRACE,
        OPREMLJENOSTI.WC_ZA_OSOBLJE WC_ZA_OSOBLJE,
        OPREMLJENOSTI.VENTILATOR VENTILATOR,
        OPREMLJENOSTI.OSVJETLJENJE OSVJETLJENJE,
        OPREMLJENOSTI.VRSTA_BROJILA VRSTA_BROJILA,
        OPREMLJENOSTI.ELEKTRO_INSTALACIJE ELEKTRO_INSTALACIJE,
        OPREMLJENOSTI.VODO_INSTALACIJE VODO_INSTALACIJE,
        OPREMLJENOSTI.TELEFONSKE_INSTALACIJE TELEFONSKE_INSTALACIJE,
        OPREMLJENOSTI.GRIJANJE_ID GRIJANJE_ID,
        OPREMLJENOSTI.POD_ID POD_ID,
        OPREMLJENOSTI.PROZORI_VRATA_ID PROZORI_VRATA_ID,
        OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID1,
        TEHNICKE_OPREMLJENOSTI.TEH_OPR_ID TEH_OPR_ID,
        TEHNICKE_OPREMLJENOSTI.ONLINE_KLADIONICA ONLINE_KLADIONICA,
        TEHNICKE_OPREMLJENOSTI.PANO PANO,
        TEHNICKE_OPREMLJENOSTI.NOSACI NOSACI,
        TEHNICKE_OPREMLJENOSTI.TV_LCD TV_LCD,
        TEHNICKE_OPREMLJENOSTI.TV_TELETEXT TV_TELETEXT,
        TEHNICKE_OPREMLJENOSTI.APARATI_IGRE APARATI_IGRE,
        TEHNICKE_OPREMLJENOSTI.EVONA EVONA,
        TEHNICKE_OPREMLJENOSTI.NOVOMATIC NOVOMATIC,
        TEHNICKE_OPREMLJENOSTI.RULET RULET,
        TEHNICKE_OPREMLJENOSTI.BILIJAR BILIJAR,
        TEHNICKE_OPREMLJENOSTI.KLIMA KLIMA,
        TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID2,
        PONUDE.PONUDA_ID PONUDA_ID,
        PONUDE.ONLINE_TERMINAL ONLINE_TERMINAL,
        PONUDE.SRECKE SRECKE,
        PONUDE.ONLINE_KLADIONICA ONLINE_KLADIONICA1,
        PONUDE.APARATI_IGRE APARATI_IGRE1,
        PONUDE.RULET RULET1,
        PONUDE.BILIJAR BILIJAR1,
        PONUDE.OBJEKAT_ID OBJEKAT_ID3
    FROM
        OBJEKTI,
        OPREMLJENOSTI,
        TEHNICKE_OPREMLJENOSTI,
        PONUDE
    WHERE
    (PONUDE.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID) OR (OPREMLJENOSTI.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID)
    ORDER BY OBJEKTI.OBJEKAT_IDThe problem I get is no matter what WHERE clause I use I get doubled values which makes no sense. I checked in the tables and I don't have any doubled values. Each Opremljenost has 1 objekat (there are 2 rows each with its own Objekat) and the same applies to the other 2 tables (PONUDE and TEHNICKE OPREMLJENOSTI) but for some reason they double up the values. If I run it without a where clause at all I get some values repeat itself up to 4 times. Does anyone have a clue what is wrong with my query?

    You are joining a parent table (OBJEKTI) with three child tables (the other three: PON, TEH, OPR).
    Whenever you do that, you will always get duplication of child-rows, if there are multiple child-rows for a parent-row in any of the three child tables.
    For example, let P be a parent table, with two child tables, say C1 and C2.
    Contents:
    Table P:
    p1
    Table C1 (has two rows for row p1):
    1 p1
    2 p1
    Table C2 (has three rows for row p1):
    10 p1
    20 p1
    30 p1If you now do this:
    select P.*,C1.*,C2.*
    from P, C1, C2
    where [join P with C1]  and [join P with C2]Then your result set will look like this:
    P.p1  C1.1  C1.p1  C2.10  C2.p1
    P.p1  C1.1  C1.p1  C2.20  C2.p1
    P.p1  C1.1  C1.p1  C2.30  C2.p1
    P.p1  C1.2  C1.p1  C2.10  C2.p1
    P.p1  C1.2  C1.p1  C2.20  C2.p1
    P.p1  C1.2  C1.p1  C2.30  C2.p1As you can see every C1 row is duplicated three times in the resultset (due to join with C2).
    And every C2 row is duplicated two times in the resultset (due to join with C1).
    This is simply what happens if you join a parent table with multiple child tables...
    Question now is: what is the expected result that you are looking for?

  • Problem with Joining Tables in VC

    Hi All,
    I am developing custom portal activity report in VC. I need to join WCR_USERPAGEUSAGE, WCR_WEBSTATCONTENT  tables. I dont have access for SQL Editor. I have used Freeform query template in BI Integration wizard and created dataservice in that joined these tables. Here I couldn,t pass parameters to this dataservice. If I pass parameter , It shows application error as null. How can I solve this problem?.
    Thanks & Regards,
    Art

    Hi Art,
    could you describe your solution, so that other users with the same issues can find help here on SDN?
    Best Regards,
    Marcel

Maybe you are looking for