Self-referencing query

Hello~
This is probably a really simple question, but here is the query I am trying to run, with no success:
          <cfquery name="updatePage" datasource="#application.db#">
                UPDATE
                    admin_nav_test
                SET
                    lft =
                        <cfif lft GT parentLevel>
                            lft + 2
                        <cfelse>
                            lft
                        </cfif>
                WHERE
                    rght >= #parentLevel#
            </cfquery>
Basically, I want to reference the current value of lft in the table I am querying within the query itself, if that makes sense. However, all I end up with is an error that says "Variable LFT is undefined." I have tried using admin_nav_test.lft, and every other combo I can think of to self-reference this variable, but no luck! What am I missing? Thanks!

I think you're probably reinventing the wheel unnecessarily here: have a look @ http://nstree.riaforge.org/
If you roll your own code - as part of a learning exercise perhaps - then make sure to transactionalise those queries, because you want both those updates to run as an atom.  Consider what would happen to your hierarchy data a second ADD operation starts being processed whilst your first one is still running.  So instead of this:
(FIRST ADD) UPDATE LEFT
(FIRST ADD) UPDATE RIGHT
(SECOND ADD) UPDATE LEFT
(SECOND ADD) UPDATE RIGHT
You ended up with this:
(FIRST ADD) UPDATE LEFT
(SECOND ADD) UPDATE LEFT
(FIRST ADD) UPDATE RIGHT
(SECOND ADD) UPDATE RIGHT
This will stuff your tree up.
I also recommend you make a generic function to pad the tree by a specified amount, rather than hardcoding "2".  When you come to want to be moving or deleting whole branches, the amount you will need to shift things will not necessarily be 2, but the operation will be the same other than the offset amount.  So you might as well factor it out into a separate function, and use that for all occasions.
Even if you decide to roll your own solution (it is a good exercise), at least eyeball the stuff on RIAForge to see how it's done, and possibly flag some considerations that might not be immediately apparent.  I rolled my own solution for this - before the RIAForge implementation was done - and it took a lot of wailing and gnashing of teeth to get it right.  And unfortunately some of the bugs didn't get noticed until the code was in production.  Which caused... "problems".
Adam

Similar Messages

  • Query output help: Display self-referencing table

    Hello,
    I'm trying to display in a cfoutput a self-referencing table.
    I'll start by showing some of the data in the table.
    There are only 3 columns, pl_id (auto increment id pri-key),
    pl_name and pl_parent_id (it's 0 if it's a parent, otherwise it's
    the pl_id value for the parent).
    pl_id pl_name pl_parent_id
    1 Country 0
    2 Food 0
    3 US 1
    4 Japan 1
    5 Hamburger 2
    6 Idaho 3
    7 Florida 3
    8 Cheese 2
    What I'm trying to output is something like this:
    Country - US - Idaho (3 levels here) or
    Country - US - Florida (or if there are only 2 levels like
    the next line)
    Food - Cheese
    I've tried using a cfoutput with a cfloop as well as grouping
    but not having any luck. Could someone clear my clouded head on
    this one?
    thanks much,
    Joe
    ps. Adobe should really use a fixed width font for these
    forums, it's impossible to line up table info!

    JoeNH2k wrote:
    > It would be nice if it were that easy, I (of course)
    tried that. The sort order
    > of the query doesn't matter. The data is not sorted once
    the function runs. The
    > sort has to come after the select box is populated by
    the function. I need to
    > get the data at this point and sort it, probably somehow
    creating a structure
    > or array from this data and sorting that(?).
    >
    <cfset myArr = ArrayNew(1)>
    <cfloop query="qryGetAll">
    <cfset temp = ArrayAppend(myArr,
    "#getNameWithParent(pl_id)#")>
    </cfloop>
    <cfset ArraySort(myArr, "textnocase", "asc")>
    <cfset myList = ArrayToList(myArr, ",")>
    then loop through myList to populate your <select>...
    how about that?
    Azadi Saryev
    Sabai-dee.com
    Vientiane, Laos
    http://www.sabai-dee.com

  • How to build query to get tree architecture of self referencing table

    Dear all,
    I have the following table design :
    This is a self referencing table representing a set of SubCategories which can have parent sub categories or not. I did not show here the Category table.
    If the Subcategory has the ParentSubCategory ID = null, then this is a root subcategory otherwise it is a child of a parent sub category.
    What I am looking for is the easy way to display the structure level by ProductCategoryID ?
    Thanks for helps

    you can use a recursive logic based on CTE for that
    something like this would be enough
    ;WITH ProdSubCat_Hiererchy
    AS
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psc.Name AS varchar(max)) AS [Path],1 AS [level]
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    WHERE psc.ParentSubCategoryID IS NULL
    UNION ALL
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psch.[Path] + '/' + psc.Name AS varchar(max)) AS [Path],psch.[level] + 1
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    INNER JOIN ProdSubCat_Hiererchy psch
    ON psch.ProductSubCategoryID = psc.ParentSubCategoryID
    SELECT *
    FROM ProdSubCat_Hiererchy
    ORDER BY LEFT([Path],CHARINDEX('/',[Path]+'/')-1),[Level]
    OPTION (MAXRECURSION 0)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Self Referencing Tables...

    I have a self-referencing table (a Topic can be a response to another Topic) and read one of Frank Nimphius' blogs on this subject, posted on the ADF board for advise. As a result I created the read-only ViewObject to set up this tree relationship and set it to be exposed to the App Module.
    Do I need to do more to it than that for JHeadstart to generate the right page defs? Any advise on setting this up cleanly? My user interface must present a page in which users can post new Topics, view topics in a heirarchy (response thread, like in this forum) and respond to Topics or responses. A response is a Topic that references another (parent) Topic. I have to believe this has been done before a million times but am not sure myself how to do it.
    Thanks!

    Steve,
    I've read the section and am getting this error:
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Topic.SUBJECT, Topic.ROW_ID, Status.STATUS_CHOICE, Status.ROW_ID AS ROW_ID11, Topic.CREATED_BY, Topic.CREATION_DATE, Response.SUBJECT AS SUBJECT1, Response.CREATION_DATE AS CREATION_DATE1, Response.ROW_ID AS ROW_ID12, Response.CREATED_BY AS CREATED_BY1 FROM TOPIC Topic, RESPONSE Response, STATUS Status WHERE (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+) ORDER BY SUBJECT,CREATION_DATE1
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01436: CONNECT BY loop in user data
    I have a table called Topic with a Pk called ROW_ID and another table called Response with a Pk called ROW_ID and an Fk called MASTER_ID. A Topic can have many Responses and a Response can also have many Responses. The parent ID could point to either a Topic or a Response. There's no limit on how many levels this can continue. There's a Status table also from which I want to show the text value of the Status for the Topic row (not the Status ROW_ID)
    I have a View Object including entities: Topic, Response & Status
    I tried the SQL query as:
    (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+)
    Hoping to have this result:
    Topic A
    -Response A (to Topic A)
    --Response B (to A)
    ---Response C (to B)
    -Response D (to Topic A)
    Topic B
    Topic C
    What am I doing wrong?
    Is there a guide that explains better using JHeadstart with JDeveloper (rather than Oracle Designer, which we don't use)? The developer's guide for JHeadstart is hard to translate for use with JDeveloper...
    Thanks!!

  • JPA: How to initialise an entity for a self-referencing table?

    I am working on a project that requires a self-referencing table:
    mysql> show create table attributes\G
    *************************** 1. row ***************************
           Table: attributes
    Create Table: CREATE TABLE `attributes` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `parent` int(11) DEFAULT NULL,
      `type` int(11) DEFAULT NULL,
      `name` varchar(128) DEFAULT NULL,
      PRIMARY KEY (`id`),
      KEY `parent` (`parent`),
      KEY `type` (`type`),
      CONSTRAINT `attributes_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `attributes` (`id`),
      CONSTRAINT `attributes_ibfk_2` FOREIGN KEY (`type`) REFERENCES `attributes` (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1
    I used NetBeans to generate an entity class from the table:
    @Entity
    @Table(name = "attributes")
    @XmlRootElement
    @NamedQueries({
        @NamedQuery(name = "Attributes.findAll", query = "SELECT a FROM Attributes a"),
        @NamedQuery(name = "Attributes.findById", query = "SELECT a FROM Attributes a WHERE a.id = :id"),
        @NamedQuery(name = "Attributes.findByName", query = "SELECT a FROM Attributes a WHERE a.name = :name")})
    public class Attributes implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Basic(optional = false)
        @Column(name = "id")
        private Integer id;
        @Size(max = 128)
        @Column(name = "name")
        private String name;
        @OneToMany(mappedBy = "parent")
        private Collection<Attributes> attributesCollection;
        @JoinColumn(name = "parent", referencedColumnName = "id")
        @ManyToOne
        private Attributes parent;
        @OneToMany(mappedBy = "type")
        private Collection<Attributes> attributesCollection1;
        @JoinColumn(name = "type", referencedColumnName = "id")
        @ManyToOne
        private Attributes type;
        @OneToMany(cascade = CascadeType.ALL, mappedBy = "attributes")
        private Collection<ItemAttributes> itemAttributesCollection;
        @OneToMany(mappedBy = "ivalue")
        private Collection<ItemAttributes> itemAttributesCollection1;
    But how can I write a constructor for this entity? The auto-generated code gets around the issue by doing nothing; the constructor is empty. I can't help thinking that if I set the parent and type references to anything with new Attributes(), then it will recurse out of control. What else can/shall I do? I know how to rewrite it to not use the entity relations, but I'd prefer to make it work.

    Cymae wrote:
    I don't want to call the hash table creation method because from what i understand about interfaces the idea is that your main method doesnt know the table is actually a hash table...is that right?That's not exactly the idea. The idea to use the interface as the type instead of the implementation, is that your class probably doesn't need to know the full type. This makes it easy to change the implementation of the interface if needed. However, somebody at some point has to create the concrete object, a HashTable.
    Basically, an interface describes a behavior, and a class that implements an interface decides how to actually perform this behavior. It is obviously impossible to perform the behavior if you are not told how to perform it.
    Table table = new HashTable() is the correct way to do it. This means that if you ever need you Table implementation to change, the only thing you need to change in your whole class is this line. For example you might want Table table = new FileTable().

  • Self referencing table and SQL statement

    In my database, I have a self-referencing table, the table itself is for projects, and it allows users to get a hierarchical view of the company.
    Here is the SQL (modifier is the term we use for project code, BBCI is the top project)
    SELECT
    modifier, modifierDescription, level
    FROM
    modifier
    WHERE
    level <= 2
    CONNECT BY PRIOR
    modifier = parentModifier
    START WITH modifier = 'BBCI'
    ORDER BY level
    That perticular query gets the first two levels in the structure. I use this information to produce a tree structure in a web app.
    But users have requested it would be good if in the tree structure is showed an + or - depending on whether there were anymore children under each parent, or better still the number of children under it, for example
    BBCI
    + BBCI_CHILD
    + BBCI_CHILD2
    - BBCI_CHILD3
    or
    BBCI
    + BBCI_CHILD (3 projects underneath)
    + BBCI_CHILD2 (2 projects underneath)
    - BBCI_CHILD3 (0 projects underneath)
    I am really stumped on this issue, and I am sure there is a way to do this in the web app, so for example do a query for each child node to see how many child nodes are underneath, but I figure it would be a lot tidier and faster if I could do it from a single SQL statement. Unfortunately I have tried to do this and am very much stuck.
    If you need more information please let me know
    Thanks!
    Jon

    You may be able to do this using analytical functions but it depends on the Oracle version you are using. It can also be done with standard SQL - you just need to count the number of child rows for each modifier/project first and supply that list as an in-line view:
    SELECT decode(modifier,'X',null,decode(child_rows,null,'-','+')),
    m.modifier,
    decode(modifier,'X',null,'('||nvl(cq.child_rows,0)||' projects underneath)')
    FROM modifier m,
    (select parentModifier,
         count(parentModifier) child_rows
    from modifier
    where parentModifier is not null
    group by parentModifier) cq
    WHERE m.modifier=cq.parentModifier(+)
    AND level <= 2
    CONNECT BY PRIOR
         m.modifier = m.parentModifier
    START WITH modifier = 'X'
    ORDER BY level, modifier;
    which gives you something like...
    D MODIFIER DECODE(MODIFIER,'X',NULL
    X
    - Y1 (0 projects underneath)
    + Y2 (2 projects underneath)
    + Y3 (3 projects underneath)
    The decode stuff is just to show you the result, you can format the output in your calling code. Just extend the columns to include everything you want, modifierDescription etc..
    Hope this helps.

  • Self referencing table and contraint

    Hi,
    I have a self referencing table, used to store information on projects in an organization. There is a pimary key (modifier) and a foreign key to the modifier field (parentModifier)
    Note: (modifier = project in the organization)
    Basically, the parentModifier cannot be equal to the modifier in the same table, or equal to any of its children, otehrwise you get wierd recursive relationships. Its like saying you cannot be your own father, or one of your children cannot be your father. To get a list of the modifiers the parentModifier cannot be, the following statement can be used:
    select
    modifier
    from
    modifier
    where
    modifier = 'A'
    and
    level >= 1
    connect by prior
    modifier = parentModifier
    start with
    modifier = 'A'
    order by
    level;
    So, now, I guess the way to do this is perform that query in a trigger before each row is being updated, so the pseudo code would be something like:
    BEFORE UPDATE ON modifier
    FOR EACH ROW
    DECLARE
    modifierToChange varchar2(255);
    modifierList ???;
    BEGIN
    select
    modifier
    into
    modifierList
    from
    modifier
    where
    modifier = 'A'
    and
    level >= 1
    connect by prior
    modifier = parentModifier
    start with
    modifier = 'A'
    order by
    level;
    if modifierToChange in modifierList
    return error
    else
    execute query
    end if
    END
    As you can see my PL/SQL is limitied. At the moment I can handle this at the application layer (in php), but if the admin going to SQL Plus and starts to fiddle, they can easy break the system, by setting an invalid relationship.
    I was wondeirng, if anyone could give me some help or advice, it would be fantastic,
    Thanks!

    Having a unique key on mod_id would be enough to make sure the same element is not in the structure more than once. By allowing it to happed you will have all the descendants of the dup element following it when you walk the tree.
    Let's say this is the intended behavior.
    Consider the following test scenario:
    create table modifier (
      mod_id varchar2(10),
      parent_mod_id varchar2(10)
    insert into modifier (mod_id, parent_mod_id) values ('a', null);
    insert into modifier (mod_id, parent_mod_id) values ('aa', 'a');
    insert into modifier (mod_id, parent_mod_id) values ('ab', 'a');
    insert into modifier (mod_id, parent_mod_id) values ('ac', 'a');
    insert into modifier (mod_id, parent_mod_id) values ('aaa', 'aa');
    insert into modifier (mod_id, parent_mod_id) values ('aab', 'aa');
    insert into modifier (mod_id, parent_mod_id) values ('aac', 'aa');
    insert into modifier (mod_id, parent_mod_id) values ('aba', 'ab');
    insert into modifier (mod_id, parent_mod_id) values ('abb', 'ab');
    insert into modifier (mod_id, parent_mod_id) values ('abc', 'ab');
    insert into modifier (mod_id, parent_mod_id) values ('aca', 'ac');
    insert into modifier (mod_id, parent_mod_id) values ('acb', 'ac');
    insert into modifier (mod_id, parent_mod_id) values ('acc', 'ac');
    insert into modifier (mod_id, parent_mod_id) values ('b', null);
    insert into modifier (mod_id, parent_mod_id) values ('ba', 'b');
    insert into modifier (mod_id, parent_mod_id) values ('bb', 'b');
    insert into modifier (mod_id, parent_mod_id) values ('bc', 'b');
    insert into modifier (mod_id, parent_mod_id) values ('baa', 'ba');
    insert into modifier (mod_id, parent_mod_id) values ('bab', 'ba');
    insert into modifier (mod_id, parent_mod_id) values ('bac', 'ba');
    insert into modifier (mod_id, parent_mod_id) values ('bba', 'bb');
    insert into modifier (mod_id, parent_mod_id) values ('bbb', 'bb');
    insert into modifier (mod_id, parent_mod_id) values ('bbc', 'bb');
    insert into modifier (mod_id, parent_mod_id) values ('bca', 'bc');
    insert into modifier (mod_id, parent_mod_id) values ('bcb', 'bc');
    insert into modifier (mod_id, parent_mod_id) values ('bcc', 'bc');
    commit;
    SQL> select lpad(' ', 2 * (level - 1)) || mod_id item
      2    from modifier
      3   start with parent_mod_id is null
      4  connect by prior mod_id = parent_mod_id;
    ITEM
    a
      aa
        aaa
        aab
        aac
      ab
        aba
        abb
        abc
      ac
        aca
        acb
        acc
    b
      ba
        baa
        bab
        bac
      bb
        bba
        bbb
        bbc
      bc
        bca
        bcb
        bcc
    26 rows selected
    Create a function to verify if a mod_id already is parent_mod_id's ascendant or descendant:
    create or replace function exists_in_parents_branch
      i_mod_id in varchar2
    ,i_parent_mod_id in varchar2
    ) return boolean is
      pragma autonomous_transaction;
      v_dummy varchar2(10);
    begin
      select mod_id
        into v_dummy
        from (select mod_id
                from modifier
               where mod_id = i_mod_id
              connect by prior mod_id = parent_mod_id
               start with mod_id = i_parent_mod_id
              union
              select mod_id
                from modifier
               where mod_id = i_mod_id
              connect by prior parent_mod_id = mod_id
               start with mod_id = i_parent_mod_id);
      return true;
    exception
      when no_data_found then
        return false;
    end exists_in_parents_branch;
    Create a trigger that calls the function above for every insert and update
    create or replace trigger biu_modifier
    before insert or update on modifier
    for each row
    begin
      if exists_in_parents_branch(:new.mod_id, :new.parent_mod_id) then
        raise_application_error(-20000, 'Cannot insert or update because of recursive relationship.');
      end if;
    end biu_modifier;
    You are all set.
    Here is a statement that should fail:
    SQL> insert into modifier (mod_id, parent_mod_id) values ('bcc', 'b');
    insert into modifier (mod_id, parent_mod_id) values ('bcc', 'b')
    ERROR at line 1:
    ORA-20000: Cannot insert or update because of recursive relationship.
    ORA-06512: at "RC.BIU_MODIFIER", line 3
    ORA-04088: error during execution of trigger 'RC.BIU_MODIFIER'
    Here is a statement that should succeed:
    SQL> insert into modifier (mod_id, parent_mod_id) values ('aaaa','aaa');
    1 row created.

  • Searchnig self-referencing HierarchyViewer ?

    Any example how to search self-referencing View object using dvt:search & dvt:searchResult ?
    The applied ViewCriteria for root nodes is :
    MASTER_ID IS NULL

    Steve,
    I've read the section and am getting this error:
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Topic.SUBJECT, Topic.ROW_ID, Status.STATUS_CHOICE, Status.ROW_ID AS ROW_ID11, Topic.CREATED_BY, Topic.CREATION_DATE, Response.SUBJECT AS SUBJECT1, Response.CREATION_DATE AS CREATION_DATE1, Response.ROW_ID AS ROW_ID12, Response.CREATED_BY AS CREATED_BY1 FROM TOPIC Topic, RESPONSE Response, STATUS Status WHERE (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+) ORDER BY SUBJECT,CREATION_DATE1
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01436: CONNECT BY loop in user data
    I have a table called Topic with a Pk called ROW_ID and another table called Response with a Pk called ROW_ID and an Fk called MASTER_ID. A Topic can have many Responses and a Response can also have many Responses. The parent ID could point to either a Topic or a Response. There's no limit on how many levels this can continue. There's a Status table also from which I want to show the text value of the Status for the Topic row (not the Status ROW_ID)
    I have a View Object including entities: Topic, Response & Status
    I tried the SQL query as:
    (Topic.ROW_ID = Response.MASTER_ID (+)) AND (Topic.TOPIC_STATUS_ID = Status.ROW_ID) CONNECT BY PRIOR Topic.ROW_ID = Response.MASTER_ID (+) OR Response.ROW_ID = Response.MASTER_ID (+)
    Hoping to have this result:
    Topic A
    -Response A (to Topic A)
    --Response B (to A)
    ---Response C (to B)
    -Response D (to Topic A)
    Topic B
    Topic C
    What am I doing wrong?
    Is there a guide that explains better using JHeadstart with JDeveloper (rather than Oracle Designer, which we don't use)? The developer's guide for JHeadstart is hard to translate for use with JDeveloper...
    Thanks!!

  • Converting multiple correlated self-referencing subqueries to Analytic Func

    I have a peoplesoft query that I am trying to improve the performance on. Using DBMS_XPLAN with gather_plan_statistics is showing me that a large portion of the time is being spent on the various correlated self-referencing MAX/MIN subqueries.
    |  24 |       SORT AGGREGATE               |                    |   9461K|      1 |    21 |            |          |        |      |            |   9461K|00:14:31.67 |     139M|  99172 |       |       |          |
    |* 25 |        TABLE ACCESS BY INDEX ROWID | PS_BAS_PARTIC      |   9461K|      1 |    21 |    12   (0)| 00:00:01 |        |      |            |     89M|00:19:10.64 |     139M|  99172 |       |       |          |
    |* 26 |         INDEX RANGE SCAN           | PSBBAS_PARTIC      |   9461K|      9 |       |     3   (0)| 00:00:01 |        |      |            |    131M|00:03:16.21 |      19M|  16193 |       |       |          |I think I understand the basic mechanism of converting a simple case to use a MAX/MIN PARTITION OVER analytic. I.E.
    select emplid, effdt, .....
    from ps_pay_check pchk1
    where pchk1.effdt = (select max(effdt)
                        from ps_pay_check pchk2
                        where pchk2.emplid = pchk1.emplid);converts to
    select emplid, effdt, .....
    from
    (select emplid,
              effdt,
              max(effdt) over (partition by emplid) max_effdt
    from ps_pay_check pchk1)
    where effdt = max_effdt;However, when you have multiple subqueries that have multiple predicates (some referencing the parent some against binds), I get a little confused.
    Here is the main example I am working with (fairly complex/ugly query).
    SELECT   /*+ gather_plan_statistics */
            A.EMPLID, A.EMPL_RCD, A.REG_REGION, A.EMPL_STATUS, A.LOCATION,
             A.ACTION_REASON, A.EFFDT, A.REG_TEMP, A.PAYGROUP, A.FULL_PART_TIME, A.JOBCODE, A.DEPTID,
             A.UNION_CD, A.FLSA_STATUS, A.STD_HOURS, A.ACTION, A.SUPERVISOR_ID, A.SETID_JOBCODE,
             B.MED_ELIG, B.DEP_LIFE_ELIG,B.SUP_LIFE_ELIG
    FROM
       PS_JOB A,
      (SELECT  EMPLID,
       max(( CASE WHEN PLAN_TYPE IN ( '10','11','14')  THEN 'Y' ELSE 'N' END)) med_elig,
       max(( CASE WHEN PLAN_TYPE IN ( '2X','2Z')  THEN 'Y' ELSE 'N' END)) dep_life_elig,
       max(( CASE WHEN PLAN_TYPE IN ( '2Y')  THEN 'Y' ELSE 'N' END)) sup_life_elig
      FROM          
        (SELECT 
           B.EMPLID, B.PLAN_TYPE
         FROM PS_BAS_PARTIC A,
             PS_BAS_PARTIC_PLAN B,
             PS_BAS_PARTIC_OPTN C
         WHERE      A.EVENT_STATUS = 'C'
             AND A.BAS_PROCESS_STATUS = 'FE'
             AND A.BAS_EVT_DISCONNECT = 'N'
             AND A.EVENT_DT = (SELECT MAX (A_ED.EVENT_DT)
                                        FROM PS_BAS_PARTIC A_ED
                                      WHERE        A.EMPLID = A_ED.EMPLID
                                              AND A_ED.EVENT_DT <= :1
                                              AND A_ED.BAS_PROCESS_STATUS = A.BAS_PROCESS_STATUS
                                              AND A_ED.BAS_EVT_DISCONNECT = A.BAS_EVT_DISCONNECT)
             AND A.SCHED_ID = B.SCHED_ID
             AND A.EMPLID = B.EMPLID
             AND A.BENEFIT_RCD_NBR = B.BENEFIT_RCD_NBR
             AND A.EVENT_ID = B.EVENT_ID
             AND B.PLAN_TYPE IN ('10', '11', '14', '2X', '2Z', '2Y')
             AND B.EMPLID = C.EMPLID
             AND B.BENEFIT_RCD_NBR = C.BENEFIT_RCD_NBR
             AND B.EVENT_ID = C.EVENT_ID
             AND B.PLAN_TYPE = C.PLAN_TYPE
             AND B.SCHED_ID = C.SCHED_ID
             AND A.EVENT_DT = (SELECT MAX (D.EVENT_DT)
                                        FROM PS_BAS_PARTIC D
                                      WHERE        A.EMPLID = D.EMPLID
                                              AND D.EVENT_STATUS = A.EVENT_STATUS
                                              AND D.EVENT_DT <= :1
                                              AND D.BAS_PROCESS_STATUS = A.BAS_PROCESS_STATUS
                                              AND D.BAS_EVT_DISCONNECT = A.BAS_EVT_DISCONNECT)
             AND C.BENEFIT_PLAN <> ' '
             AND A.STATUS_DT = (SELECT MAX (E.STATUS_DT)
                                         FROM PS_BAS_PARTIC E
                                        WHERE      E.EVENT_STATUS = A.EVENT_STATUS
                                                AND E.EMPLID = A.EMPLID
                                                AND E.BAS_PROCESS_STATUS = A.BAS_PROCESS_STATUS
                                                AND E.BAS_EVT_DISCONNECT = A.BAS_EVT_DISCONNECT
                                                AND E.EVENT_DT = A.EVENT_DT)
             AND A.EVENT_PRIORITY = (SELECT MIN (F.EVENT_PRIORITY)
                                                FROM PS_BAS_PARTIC F
                                              WHERE        F.EMPLID = A.EMPLID
                                                      AND F.EVENT_STATUS = A.EVENT_STATUS
                                                      AND F.BAS_PROCESS_STATUS = A.BAS_PROCESS_STATUS
                                                      AND F.BAS_EVT_DISCONNECT = A.BAS_EVT_DISCONNECT
                                                      AND F.EVENT_DT = A.EVENT_DT
                                                      AND F.STATUS_DT = A.STATUS_DT)
         GROUP BY EMPLID) B
    WHERE  A.EMPLID = B. EMPLID
                AND  A.PER_ORG = 'EMP'
                AND A.EFFDT = (SELECT MAX (A_SUB.EFFDT)
                                    FROM PS_JOB A_SUB
                                  WHERE        A.EMPLID = A_SUB.EMPLID
                                          AND A.EMPL_RCD = A_SUB.EMPL_RCD
                                          AND A_SUB.EFFDT <= :3)
                AND A.EFFSEQ = (SELECT MAX (A_SUB2.EFFSEQ)
                                     FROM PS_JOB A_SUB2
                                    WHERE      A.EMPLID = A_SUB2.EMPLID
                                            AND A.EMPL_RCD = A_SUB2.EMPL_RCD
                                            AND A.EFFDT = A_SUB2.EFFDT)
    ORDER BY A.EMPLID;As you can see this has a total of 6 different MAX/MIN subqueries. Can all of them be turned into analytic equivalents, and how are the different predicates of the subqueries handled?
    Any help appreciated!
    Thanks
    Wayne

    The full query takes roughly 25 min. With 14.5 min taken by the first correlated subquery, MAX (A_ED.EVENT_DT).
    Here's the full plan:
    | Id  | Operation                          | Name               | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |    TQ  |IN-OUT| PQ Distrib | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                   |                    |      1 |        |       |   220M(100)|          |        |      |            |      1 |00:24:59.66 |     181M|    398K|       |       |          |
    |*  1 |  FILTER                            |                    |      1 |        |       |            |          |        |      |            |      1 |00:24:59.66 |     181M|    398K|       |       |          |
    |   2 |   NESTED LOOPS                     |                    |      1 |      6 |   636 |   220M  (1)|733:42:27 |        |      |            |      1 |00:24:59.65 |     181M|    398K|       |       |          |
    |   3 |    VIEW                            |                    |      1 |      1 |    16 |   220M  (1)|733:42:27 |        |      |            |      1 |00:24:59.64 |     181M|    398K|       |       |          |
    |   4 |     SORT AGGREGATE                 |                    |      1 |      1 |   102 |            |          |        |      |            |      1 |00:24:59.64 |     181M|    398K|       |       |          |
    |*  5 |      FILTER                        |                    |      1 |        |       |            |          |        |      |            |     23M|00:23:02.81 |     181M|    398K|       |       |          |
    |   6 |       PX COORDINATOR               |                    |      1 |        |       |            |          |        |      |            |     76M|00:06:42.64 |     300K|    299K|       |       |          |
    |   7 |        PX SEND QC (RANDOM)         | :TQ10004           |      0 |     18M|  1792M|   199K  (2)| 00:39:54 |  Q1,04 | P->S | QC (RAND)  |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |*  8 |         HASH JOIN BUFFERED         |                    |      0 |     18M|  1792M|   199K  (2)| 00:39:54 |  Q1,04 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |   325M|    16M|          |
    |   9 |          BUFFER SORT               |                    |      0 |        |       |            |          |  Q1,04 | PCWC |            |      0 |00:00:00.01 |       0 |      0 | 73728 | 73728 |          |
    |  10 |           PX RECEIVE               |                    |      0 |   3405K|   152M| 19585   (2)| 00:03:56 |  Q1,04 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  11 |            PX SEND HASH            | :TQ10001           |      0 |   3405K|   152M| 19585   (2)| 00:03:56 |        | S->P | HASH       |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |* 12 |             TABLE ACCESS FULL      | PS_BAS_PARTIC      |      1 |   3405K|   152M| 19585   (2)| 00:03:56 |        |      |            |   3302K|00:00:10.18 |   87732 |  87726 |       |       |          |
    |  13 |          PX RECEIVE                |                    |      0 |     24M|  1289M|   179K  (2)| 00:35:59 |  Q1,04 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  14 |           PX SEND HASH             | :TQ10003           |      0 |     24M|  1289M|   179K  (2)| 00:35:59 |  Q1,03 | P->P | HASH       |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |* 15 |            HASH JOIN BUFFERED      |                    |      0 |     24M|  1289M|   179K  (2)| 00:35:59 |  Q1,03 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |   730M|    18M|          |
    |  16 |             BUFFER SORT            |                    |      0 |        |       |            |          |  Q1,03 | PCWC |            |      0 |00:00:00.01 |       0 |      0 | 73728 | 73728 |          |
    |  17 |              PX RECEIVE            |                    |      0 |     12M|   279M| 47310   (3)| 00:09:28 |  Q1,03 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  18 |               PX SEND HASH         | :TQ10000           |      0 |     12M|   279M| 47310   (3)| 00:09:28 |        | S->P | HASH       |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |* 19 |                INDEX FAST FULL SCAN| PS_BAS_PARTIC_PLAN |      1 |     12M|   279M| 47310   (3)| 00:09:28 |        |      |            |     12M|00:00:57.03 |     213K|    211K|       |       |          |
    |  20 |             PX RECEIVE             |                    |      0 |     84M|  2499M|   132K  (2)| 00:26:30 |  Q1,03 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  21 |              PX SEND HASH          | :TQ10002           |      0 |     84M|  2499M|   132K  (2)| 00:26:30 |  Q1,02 | P->P | HASH       |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  22 |               PX BLOCK ITERATOR    |                    |      0 |     84M|  2499M|   132K  (2)| 00:26:30 |  Q1,02 | PCWC |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |* 23 |                TABLE ACCESS FULL   | PS_BAS_PARTIC_OPTN |      0 |     84M|  2499M|   132K  (2)| 00:26:30 |  Q1,02 | PCWP |            |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |  24 |       SORT AGGREGATE               |                    |   9461K|      1 |    21 |            |          |        |      |            |   9461K|00:14:31.67 |     139M|  99172 |       |       |          |
    |* 25 |        TABLE ACCESS BY INDEX ROWID | PS_BAS_PARTIC      |   9461K|      1 |    21 |    12   (0)| 00:00:01 |        |      |            |     89M|00:19:10.64 |     139M|  99172 |       |       |          |
    |* 26 |         INDEX RANGE SCAN           | PSBBAS_PARTIC      |   9461K|      9 |       |     3   (0)| 00:00:01 |        |      |            |    131M|00:03:16.21 |      19M|  16193 |       |       |          |
    |  27 |       SORT AGGREGATE               |                    |   1093K|      1 |    23 |            |          |        |      |            |   1093K|00:00:47.55 |      13M|      0 |       |       |          |
    |* 28 |        TABLE ACCESS BY INDEX ROWID | PS_BAS_PARTIC      |   1093K|      1 |    23 |    12   (0)| 00:00:01 |        |      |            |   9182K|00:00:53.32 |      13M|      0 |       |       |          |
    |* 29 |         INDEX RANGE SCAN           | PSBBAS_PARTIC      |   1093K|      9 |       |     3   (0)| 00:00:01 |        |      |            |     12M|00:00:13.00 |    2230K|      0 |       |       |          |
    |  30 |       SORT AGGREGATE               |                    |   1093K|      1 |    31 |            |          |        |      |            |   1093K|00:00:43.48 |      13M|      0 |       |       |          |
    |* 31 |        TABLE ACCESS BY INDEX ROWID | PS_BAS_PARTIC      |   1093K|      1 |    31 |    12   (0)| 00:00:01 |        |      |            |   1122K|00:00:41.05 |      13M|      0 |       |       |          |
    |* 32 |         INDEX RANGE SCAN           | PSBBAS_PARTIC      |   1093K|      9 |       |     3   (0)| 00:00:01 |        |      |            |     12M|00:00:12.98 |    2229K|      0 |       |       |          |
    |  33 |       SORT AGGREGATE               |                    |   1077K|      1 |    35 |            |          |        |      |            |   1077K|00:00:42.82 |      13M|      0 |       |       |          |
    |* 34 |        TABLE ACCESS BY INDEX ROWID | PS_BAS_PARTIC      |   1077K|      1 |    35 |    12   (0)| 00:00:01 |        |      |            |   1079K|00:00:40.67 |      13M|      0 |       |       |          |
    |* 35 |         INDEX RANGE SCAN           | PSBBAS_PARTIC      |   1077K|      9 |       |     3   (0)| 00:00:01 |        |      |            |     12M|00:00:12.62 |    2197K|      0 |       |       |          |
    |  36 |    TABLE ACCESS BY INDEX ROWID     | PS_JOB             |      1 |      6 |   540 |     8   (0)| 00:00:01 |        |      |            |      1 |00:00:00.02 |       4 |      4 |       |       |          |
    |* 37 |     INDEX RANGE SCAN               | PS0JOB             |      1 |      6 |       |     2   (0)| 00:00:01 |        |      |            |      1 |00:00:00.01 |       3 |      3 |       |       |          |
    |  38 |   SORT AGGREGATE                   |                    |      1 |      1 |    19 |            |          |        |      |            |      1 |00:00:00.01 |       3 |      1 |       |       |          |
    |* 39 |    INDEX RANGE SCAN                | PSAJOB             |      1 |      1 |    19 |     3   (0)| 00:00:01 |        |      |            |      1 |00:00:00.01 |       3 |      1 |       |       |          |
    |  40 |   SORT AGGREGATE                   |                    |      1 |      1 |    22 |            |          |        |      |            |      1 |00:00:00.01 |       3 |      0 |       |       |          |
    |* 41 |    INDEX RANGE SCAN                | PSAJOB             |      1 |      1 |    22 |     3   (0)| 00:00:01 |        |      |            |      1 |00:00:00.01 |       3 |      0 |       |       |          |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Yes, I was also puzzled by the 2 almost identical EVENT_DT subqueries. The second one, with EVENT_STATUS, only takes about 1 min of the execution time (since the EVENT_STATUS filters the records processed by the subquery by an order of magnitude). I haven't had a chance to ask the developers about it yet, but it does make a difference in the output. Though, even if I were to take out the second one, the performance and question of the proper format of the Analytic functions would remain.

  • Need help on self referencing a ssrs report

    Hi All,
    I have a graph on one of my report which shows data on level 1 by default and go on showing level 2 and level 3 data on successive clicks. This has been achieved by self referencing a ssrs report and passing respective parameters. Now to identify which level
    data needs to be shown on graph, I have used one more parameter which default value is 1 and go on increasing to 2 then 3 on successive click and this parameter value is used in group expression of graph. This works just fine.
    But the real problem has occurred when you go and select report parameters which are corresponding to level 1, level 2 and level 2 values and click on apply in between. For e.g. Assume level 1=Region, level 2=SubRegion and level 3=Country. When you run this
    report it shows region wise data on graph and value of fourth parameter is 1, now when you click on graph it takes you to level 2 i.e. it shows sub region wise data on graph and value of fourth parameter is 2 but when you go and select all region, sub region
    and countries from report parameters and click on apply button then it should show data on graph region wise but since the time you were selecting parameter data was sub region wise and value of fourth parameter was 2 it shows data for all sub regions which
    is weird and not acceptable at all. 
    I am hoping SSRS should provide a way to pass parameters just like we pass in action on any control within ssrs report to solve this issue. Please help me out to solve this issue or let me know if need more infor.

    Hi,
    There was an error reading from the pipe: Unrecognized error 109 (0x6d).
    One reason was inconsistent binding between client and server <netNamedPipeBinding> <security mode="None"></security>... (no
    communication)
    The other intermittent issue was time-out related.
    For more information, you could refer to:
    http://stackoverflow.com/questions/15836199/wcf-namedpipe-communicationexception-the-pipe-has-been-ended-109-0x6d
    http://stackoverflow.com/questions/22334514/wcf-named-pipe-error-the-pipe-has-been-ended-109-0x6d
    Regards

  • Best practice: self referencing table

    Hallo,
    I want to load a self referencing table to my enterprise area in the dwh. I am not sure how to do this. What if a record references to another record which is inserted later in the same etl process? There is now way to sort, because it is possible that record a references to record b and record b references to record a. Disabling the fk constraint is not a good idea, because this doesn't prevent that invalid references will be loaded? I am thinking of building two mappings, one without the self referencing column and the other only with it, but that would cause approx. twice as much running time. Any other solutions?
    Regards,
    Torsten

    Mind sharing the solution? Would be interested to hear your solution (high level).
    Jean-Pierre

  • Problem with self referencing cells

    Hello there,
    I'd like to have two columns that are NULL, unless the other column has a value entered into it.
    This seems to create an infinite lookup loop of self referencing.
    Can anyone suggest a work around?
    Please see example
    http://public.iwork.com/document/?a=p175104233&d=self_reference.numbers

    If for instance you have
    cell B2 = IF(C2="","","Not Null")
    and
    cell C2 = IF(B2="","", "Not Null")
    then, yes, you have a circular reference
    It sounds like what you want is if you enter (by hand, overwriting the formula that is there) a value in B2 then the formula in C2 will result in a value (not null). If you, instead, enter a value in C2 then the formula in B2 will result in a value.
    Try this addition to the formula:
    B2=IFERROR(IF(C2="","","not null"),"")
    C2=IFERROR(IF(B2="","","not null"),"")
    In other words, wrap it all up in an IFERROR
    Message was edited by: Badunit

  • ORA-02291 during MERGE on self-referenced table

    Hello,
    I encountered error ORA-02291 when I tried to use MERGE statement on the table with "self-referenced" foreign key. Using the foreign key deferrable did not help. The only one thing, which helped me, was using errorlog table. See the demonstration:
    Working as common user:
    SQL> CONNECT scott/tiger
    First of all, I create table and (not deferrable) constraints:
    CREATE TABLE fkv (
         id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
         parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    INSERT is working well:
    INSERT INTO fkv (
         id,
         parent_id
    SELECT
    1,
    1
    FROM
    DUAL;
    COMMIT;
    1 rows inserted.
    commited.
    MERGE statement using UPDATE branch is working well too:
    MERGE INTO fkv USING (
    SELECT
    1 AS ID,
    1 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    COMMIT;                                        
    1 rows merged.
    commited.
    And now is coming the strange behaviour:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    SQL Error: ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ROLLBACK;
    rollback complete.
    Ok, even it is not a good solution, I try deferrable constraint:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(id) DEFERRABLE INITIALLY DEFERRED;
    table FKV altered.
    table FKV altered.
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    1 rows merged.
    COMMIT;
    SQL Error: ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ... deffered constraint did not help :-(
    Let's try another way - errorlog table; for the first with the not deferrable constraint again:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    table FKV altered.
    table FKV altered.
    BEGIN
    sys.dbms_errlog.create_error_log (
    dml_table_name => 'FKV',
    err_log_table_name => 'ERR$_FKV'
    END;
    anonymous block completed
    Toys are prepared, let's start with error logging:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID)
    LOG ERRORS INTO err$_fkv;
    1 rows merged.
    Cannot belive, running SELECT for confirmation:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Ok, COMMIT:
    COMMIT;
    commited.
    SELECT for confirmation again:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Using deffered constraint and error logging is working well too.
    Metalink and Google did not help me. I am using databases 10.2.0.5 and 11.2.0.3.
    Has somebody encountered this problem too or have I missed something?
    Thank you
    D.

    drop table fkv;
    CREATE TABLE fkv (
    id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
    parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    CREATE INDEX PK_FKV_ID ON FKV(ID);
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE FKV ADD CONSTRAINT FK_FKV_PAID FOREIGN KEY (PARENT_ID) REFERENCES FKV(ID);Now run your MERGE statement and it works with non deferrable constraints.
    Personally, I would contact support about this before depending on it in production.
    P.S. I was not able to reproduce your findings that dropping and re-adding the constraints changes things. I suspect that when you dropped the constraint the index was NOT dropped, so you kept a non-unique index.
    Try again using ALTER TABLE FKV DROP CONSTRAINT PK_FKV_ID drop index;

  • EJB-QL with self referencing cmr-field in path identifier fails

    I have a simple application . Only one bean and one relationship. The relationship is a (0..1)-(0..1) for the same bean (self referencing).
    I have a finder method defined with ejb-ql that tries to access the field of one of the cmr fields of the relationship.
    class1Bean is the abstract schema for my bean, and subclass1 is the cmr-field name.
    SELECT OBJECT(obj) FROM class1Bean obj WHERE obj.subclass1.id LIKE ?1
    Here is the error message when trying to deploy:
    Bean: Class1
    Method: java.util.Collection findBySubclass1(java.lang.String)
    EJBQL: SELECT OBJECT(obj) FROM class1Bean obj WHERE obj.subclass1.id LIKE ?1
    Error: JDO75100: Fatal internal error: JDO75341: Missing field meta data for field 'subclass1' of 'Class1'
    This same code deploys fine on JBoss 4.0, and should be legal ejb-ql. Is this a known issue with Sun JSAS?

    Sounds like a problem with the bean metadata. Please check the entity mapping defined in sun-cmp-mappings.xml. Also make sure field sublass1 is defined as CMR everywhere.
    -- markus.

  • Self referencing VO in an ADF Tree

    Hi @all
    i want to create an ADF Tree and found the following helpful example:
    ADF Code Corner sample #32 show how to build a tree table from a self referencing VO:
    [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples]
    But i still have two questions:
    1. How can i concatenate two attributes in the View Instance?
    Table looks like
    ID ParentID OrderNo ShortText
    ====================
    1 (null) 10 Text1
    2 1 20 Text2
    3 2 30 Text3
    4 1 50 Text4
    The result should be 10.20.30.
    2. For the first tree-level the change of the ShortText attribut works fine:
    OrderNo: 10 -> Text1
    OrderNo: 50 -> Text4
    (Tree->SelectionListener: #{bindings.WicNodeView1.treeModel.makeCurrent}
    RichTextEditor -> partialTrigger: t1 (the Tree))
    But not for the Sub-Levels:
    The Problem is OrderNo 30 shows also Text1 (and not Text3).
    Do i have to write a method (bean) for the Selection Listener or is there another (shorter) way (i am using Oracle JDeveloper 11.1.2.1.0)?
    Thanks for your help!
    Gregor

    Hi,
    this should work the same. You create a tree from a POJO Data Control based on your POJO Model. Expose another collection pointing to the same data set and drag it as the form. Use the setting on the tree configuration dialog to set the current row in the tree as the current in the form iterator.
    Frank

Maybe you are looking for