Variable one to one

Hi,
1) Is it possible to have the class indicator in a variable one to one mapping set to a function call, or a pl/sql expression instead of a field?
2) I am trying to use the workbench to create a variable one to one but the reference descriptor dropdown does not show anything.
Thanks!
Calin

1 - You could use custom SQL or stored procedures in your queries to read the source object of the variable 1-1 and potentially provide the indicator value from a function, but this would be very complex. You would probably be better off having an indicator field, or not using an indicator (it is optional). Perhaps some more information on what you are trying to do?
2 - A variable 1-1 mapping is a 1-1 relationship from the source descriptor to one of several different classes that share a common interface. You must have a common interface between the target classes and define an interface descriptor for the interface in the Mapping Workbench.

Similar Messages

  • How to use bind variable value of one VO as initial value for other VO row?

    JDeveloper 10.1.3.3, ADF Faces, ADF BC
    Hi,
    I have two View Objects: one read only with several bound variables and another editable entity based. Correspondingly there are two ADF Faces pages: first contains search form based on the read-only VO and second create form based on the editable VO. The search form has several hidden fields for some of bound variables because they aren't edited directly by user. These fields are updated with PPR when user selects other search criteria from LOV.
    There is a command button in the first page that navigates to the second form. Is there any way to transfer values of bound variables from the first VO to the second VO as initial values of the new row?
    I tried to set custom controller for the second page and retrieve search criteria values from request parameter map but values from hidden fields are missing. I think because that these fields are updated by PPR. Of course I can add custom action method to the navigation button and in the method put these values to request parameter map but I hope there is better solution.
    Thanks,
    Marius

    To summarize, given a bind variable value for one VO, on creating a row in a second VO, for 1 of the attributes of the second VO, you want to use the first VO's bind variable value. Correct?
    A potential solution ADF BC driven:
    1) Ensure you have an AppModuleImpl for your AM
    2) Ensure you have a ViewImpl for your 1st VO (where the bind variable will exist) - lets refer to that VO as "Alpha"
    3) Ensure you have a ViewRowImpl for your 2nd VO (the one you want to default the value in) - lets refer to that VO as "Beta"
    4) For your first VO "Alpha" create the bind variable (say pValue)
    5) In your second VO "Beta" ViewRomImpl add following code:
    @Override
    protected void create(AttributeList attributeList) {
      super.create(attributeList);
      AppModuleImpl am = (AppModuleImpl)this.getApplicationModule();
      String someValue = am.getAlphaView1().getpValue();
      setSecondVOAttr(someValue); // change this code to whatever your setter is for the field you want to initialize.
    }Hope this helps. Let us know how you go.
    Regards,
    CM.

  • Variable sharing from one class to another??

    Hi!!
    Suppose two classes, one class extend from JFrame and another
    from JDialog.I want to share the variable of Second one(extending JDialog) into firstone.How can I get this? please help me.

    For example:
    In JFrame class...
    JDialog theDialog = new JDialog ...
    someVariable = theDialog.getVariable();
    In the JDialog class, add the getVariable method.

  • Variable One to One - difficult question

    Hi
    I am using a Variable One to One mapping but TL is not using the class indicator information to produce the correct SQL and I wonder what I am doing wrong.
    I have the following simplified database design:
    Users:
    userId (pk)
    Applications:
    applicationId (pk)
    ServiceProviders
    serviceProviderId (pk)
    applicationId (fk)
    Services
    serviceId (pk)
    serviceProviderId (fk)
    UserEntities
    userId (pk, fk)
    entityId (pk)
    entityTypeId (pk)
    The Id values for different entity types are mutually exclusive - there can be a serviceId #1 and a serviceProviderId #1.
    I have several classes that implement an Entity interface (Application, ServiceProvider, Service), and a UserEntity class containing a reference to a User and an Entity.
    In the descriptors for classes implementing Entity I have a one to many mapping to UserEntity, with a table reference constructed in MW, and a single source / target field pair of e.g. entityId - applicationId. In the UserEntity descriptor I have a one to one mapping to User and a variable one to one mapping to Entity. This contains a Class Indicator based on the entityTypeId field, and values for each class implementing Entity have been entered.
    It seems that when I insert a new UserEntity instance, this class indicator value is used to supply a value for the entityTypeId field. When I access the userEntities collection from a User instance, the class indicator is used to instantiate the correct kind of Entity. But when I access the userEntities collection from an instance of the an Entity class like the Application class, the EntityTypeId is not specified in the SQL generated:
    ServerSession(30932017)--Connection(24156236)--SELECT ENTITYID, ENTITYTYPEID, USERID FROM USERENTITIES WHERE (ENTITYID = ?)
    bind => [1]
    #### I would expect 'AND ENTITYTYPEID = ? ..... bind => [2]' here #####
    I would expect the class indicator info to be used both ways, when determining what class to instantiate for the variable one to one, and also to make the query specific to that class when an instance is being used.
    Many thanks if you can shed some light on this. Perhaps I have to use an API method as demonstrated in this post how can i map this?
    James

    James
    Thanks for your reply.
    I have a similar NullPointerException on the validateNode method. I slavishly followed your code example - hope it was right :), so will raise this with Oracle support.
    public static void amendApplicationUserEntityResp(Descriptor descriptor) {
         OneToManyMapping mapping = (OneToManyMapping) descriptor.getMappingForAttributeName("responsibilitiesInherited");
         ExpressionBuilder builder = new ExpressionBuilder();
         mapping.setSelectionCriteria(
              builder.getField("USERENTITYRESPINHERITED.ENTITYID").equal(builder.getParameter("APPLICATIONS.APPLICATIONID")
              .and(builder.getField("USERENTITYRESPINHERITED.ENTITYTYPEID").equal(1)))

  • How to pass a variable more than one values?

    How to pass a variable more than one values?

    You can't.
    During 1 session, 1 ODI variable can have only 1 value at a time.
    If you need more than 1 value, you will have to do somethink like a loop inside your package, and refresh the variable value each time.

  • Variables -  Sap business one

    Hi I have a print layout design form designed by someone else.  I would like to modify it and have noticed that it uses a variable number for one of the fields.  How can i tell what the variable definition is for this variable? thankyou

    Judi - a suggestion as I got burnt on this area - be VERY VERY careful when using variables in the Print Layout Designer (PLD).  I walked into a customer's office and said the information she wanted could be included as part of the results with PLD by using the variables displayed in the system.  A bit embarassed when the results came out funky and certainly not what she was looking for.
    I did an extensive amount of research and submitted a ticket to SAP, and here is their reply (verbatim from the ticket):
    "The fields in the other report that are showing results 'Text Type Field'
    are harcoded or system fields and they only can be used by our
    development team...
    <u>Variables are generally not supported by us as they can be subject to
    change in patches or upgrades.  Please check Note 723783...
    We do not guarentee that the displayed Variable Numbers are valid
    and will print the correct information...</u>
    Adding Variables can as well corrupt your Layout in General. Therefore
    we do not encourage you to try to add your own Variables..."
    By "displayed variable numbers", SAP Support was referring to some numbers I had copied down from the forms themselves and passed on to SAP asking why they were not as documented.  But guess what - the variables did NOT print the same info in the PLD as what was displayed on the system!   It turned out to be a real mess.
    I am especially worried about the statement that variables can change in patches or upgrades and wonder if there will be some work to be done for when any PLD was modified?

  • Variable one to one mapping question

    I'm trying to create a variable one to one mapping using an interface with two implementing classes. The problem that I have is that I have two different values in the class indicator column that I wish to map to the same class. Mapping workbench doesn't let me do this. The MW documentation discusses using unique primary keys by leaving the class indicator blank. However, i'm using 9.0.4.8 and this doesn't appear to work as I get exceptions at runtime.
    Is there anything along the lines of the inheritance classextraction method for interfaces? Any suggestions for how to go about this?
    Thanks in advance,
    Jonathan

    Hi Jonathan,
    This use case is not supported in the Workbench. You will have to define an After Load Method in the workbench and add the indicator->class mappings in code. I am not positive on how this is handled in the runtime. Which indicator would be used when writing, maybe only supported for read-only mappings, or possibly not supported at all? Someone from the runtime team can respond about this.
    Karen

  • How to query objects on variable one-to-one relationship

    Hi,
    I have a situation here:
    Application (APPLICATION table) has many payoffs (Payoff table); Primary key of application is the foreign key of payoff.
    Payoff has disbursement, such as check(check table), directDeposit(directDeposit table) or Wire(wire table), which is variable one-to-one relationship. They share the same primary key
    The query I need to run is to search application based on check number, How do I construct a query to perform this kind of search?
    Thanks
    Hao
    [email protected]

    Hi Doug,
    Thanks for all your help. But I guess I still need more details from you to help me understand the solution.
    First of all, I want to make sure I make my case clear
    Application (application table, pk: uniqueAppId) has many payoffs (Payoff table, pk: payoffId);
    Payoff object has variable one-to-one mapping to Disbursement object, which is a abstract super clss for following objects:
    Check(payoff-check table, pk: payoffId)
    DirectDeposit(payoff-deposit table, pk: payoffId)
    Wire(payoff-wire table, pk: payoffId),
    The query I want to run is to get me back an application for a particular check number
    From you email, first I thought "check" is a object, then your sample code showed it is a string. So I am kind of confused. The document you pointed seems not reflect my case. I wonder it is because I didn't present my case clear the first time.
    Looking forward to your further help
    Hao

  • Aggregate and variable one-to-one

    Hi,
    I would like to create a variable one-to-one mapping in my aggregate target descriptor, but when I want to set up the query key associations, the foreign key field is disabled. Is this not possible, or am I missing something?
    Regards,
    Katarina

    Hi,
    I would like to create a variable one-to-one mapping in my aggregate target descriptor, but when I want to set up the query key associations, the foreign key field is disabled. Is this not possible, or am I missing something?
    Regards,
    Katarina

  • Variable One-to-one mapping

    i am working on variable one-to-one mapping. i am unable to figure out how to work on it. can anybody provide an example on how to implement it from java and toplink perspectives.

    Thank you. I have gone through the links. i used class indicator field method. I am still getting error saying
    "Exception Description: Missing descriptor for [class java.lang.String]. Verify that the descriptor has been properly registered with the Session."
    My code and table structure is as below.
    Interface - VariableOneToOne
    Implementation classes: Phone and Email
    Table Structure:
    Employee Table:
    ID (PK)
    Name
    TYPE (mapped as variable one-to-one)
    C_ID(FK to eid and pid)
    Phone Table:
    pid (PK)
    phnumber
    Email Table:
    eid (PK)
    emailaddress
    "TYPE" is of string type. "Phone" or "Email" is sent from this attribute. Toplink instantiates the respective class from the configurations specified in the variable one-to-one mapping of "TYPE" attribute in workbench.
    The classes and interface code is as below:
    Inteface:
    package com.cts;
    public interface VariableOneToOne {
         public int getId();
         public void setId(int id);
    Employee Class:
    package com.cts;
    public class Employee2{
         protected int id;
         protected String name;
         protected String type;
         protected VariableOneToOne phone;
         protected VariableOneToOne email;
         public Employee2()
              this.id = 0;
              this.name = null;
              this.type = null;
              this.phone = null;
              this.email = null;
         public int getId() {
              return id;
         public void setId(int id) {
              this.id = id;
         public String getName() {
              return name;
         public void setName(String name) {
              this.name = name;
         public String getType() {
              return type;
         public VariableOneToOne getEmail() {
              return email;
         public void setEmail(VariableOneToOne email) {
              this.email = email;
         public VariableOneToOne getPhone() {
              return phone;
         public void setPhone(VariableOneToOne phone) {
              this.phone = phone;
         public void setType(String type) {
              this.type = type;
    Email Class:
    package com.cts;
    public class Email2 implements VariableOneToOne {
         protected int id;
         protected String email;
         public Email2() {
              this.id = 0;
              this.email = null;
         public String getEmail() {
              return email;
         public void setEmail(String email) {
              this.email = email;
         public int getId() {
              return id;
         public void setId(int id) {
              this.id = id;
    Phone Class:
    package com.cts;
    public class Phone2 implements VariableOneToOne {
         protected int id;
         protected String phone;
         public Phone2()
              this.id = 0;
              this.phone = null;
         public int getId() {
              return id;
         public void setId(int id) {
              this.id = id;
         public String getPhone() {
              return phone;
         public void setPhone(String phone) {
              this.phone = phone;
    Please advice on resolving the issue.
    Thanks in advance.

  • One to one mapping question -- can I just map a lookup field for queries?

    I have a table with a state code. I'd like to have a "virtual lookup" on the java class to a region table. I.e., this java class "studies" has a state code. I can map a one-to-one to the descriptor class that has the ref table, but I'd like to have a property in the java class pre-mapped to the "region" field in this lookup so for querying i can just use:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(study.class);
    q.setSelectionCriteria(new ExpressionBuilder().get("Region").equal(Region));
    to get all the studies for a particular region.
    am I going about this wrong? or do I have to get the reference table descriptor fromt he one to one map and do something different?

    well,on the way home last nite, I realized I'd had a complete brain fart. I've done this before. I just set up a 1-1 map between descriptors and then built the query like this:
    q.setSelectionCriteria(new ExpressionBuilder().get("refFPO").get("FPO_NO").equal(FPO));
    You can get the pointer to the "refFPO" which is the the descriptor mapped 1-1, then appended the column you wish to get.
    I still went ahead and amended my class to include a read-only, non-toplink mapped attribute "FPO" which just gets the reference variable pointing to "refFPO.getFPO_NO();
    I answered my own question just in case anyone wondered ....

  • I want to show labels having images one by one in Panel

    i want to show labels having images one by one in Panel through a while loop...
    I made an ImagIcon array.
    It doesn't work properly.
    It shows only first image while the variable is incrementing. :(
    This is my code...(Plz check it....)
    import java.awt.*;
    import javax.swing.*;
    public class test extends JFrame
    ImageIcon imgIco = new ImageIcon("mylogo.jpg");
    ImageIcon imgIco1 = new ImageIcon("mylogo1.jpg");
    ImageIcon imgIco2 = new ImageIcon("mylogo2.jpg");
    ImageIcon imgIco3 = new ImageIcon("mylogo3.gif");
    ImageIcon imgIco4 = new ImageIcon("mylogo4.gif");
    ImageIcon[] a = {imgIco,imgIco1,imgIco2,imgIco3,imgIco4};
    JButton b1 = new JButton("Add");          
    JLabel l1;
    JPanel p1 = new JPanel();
    public test(String title)
    super(title);
    int s = 0;
    while(s<=4)          
         try
              Thread.sleep(100);
              System.out.println(s);
              l1 = new JLabel(a[s]);
              repaint();
         /*if(s==1)
              p1.remove(l1);     
         catch(Exception e)
         System.out.println("Error Occured!!!");
         p1.add(l1);     
    System.out.println(s);
    s++;                              
         setContentPane(p1);          
    public static void main(String args[])     
         test t = new test("Title");
         t.setSize(900,470);
    t.setVisible(true);
    t.setResizable(false);

    You are sleeping the thread used to perform the repaint.
    Calling repaint only marks a component as needing painting, and AWT will paint it later. If you continue to loop in the mainthread then you will not see the changes.
    You have to move your loop to another thread.

  • How to read the row of resulted table one by one

    Hi,
    My query is displaying n no of rows in resulted table.Is there any way to read the row one by one and pass the value of attribute in other variable.
    If anybody knows then please let me know.
    thanks
    Divya

    hi
    read the VO using RowSetIterator
    OAViewObject reqLinesVO = (OAViewObject)am.findViewObject("VO");
    if(reqLinesVO!=null)
    int fetchedRowCount = reqLinesVO.getFetchedRowCount();
    RowSetIterator reqLinesIter = reqLinesVO.createRowSetIterator("reqLinesIter");
    if (fetchedRowCount > 0)
    reqLinesIter.setRangeStart(0);
    reqLinesIter.setRangeSize(fetchedRowCount);
    for (int i = 0; i < fetchedRowCount; i++)
    OARow row = (OARow)reqLinesIter.getRowAtRangeIndex(i);
    String getattr=(String) row.getAttribute("Attribute14");
    // Always close the iterator when you're done.
    reqLinesIter.closeRowSetIterator();
    thanx
    Pratap

  • One column one row w/ separator to be hierarchical columns

    Dear Gurus,
    I want to present the "+one column/one row data+"
    F:\JDeveloper\Tut\TIJ4-code\generics\watercolors\Watercolors.javaas this follow:
    id               parent_id
    Watercolors.java     watercolors
    watercolors          generics
    generics          TIJ4-code
    TIJ4-code          Tut
    Tut               JDeveloper
    JDeveloper          F:Id better using an sql rather than pl/sql.
    regards,

    I think you'd struggle to do this in SQL alone, unless you use some fancy MODEL clause or Michaels can come up with some nifty XML solution. I would probably go with some PL/SQL as a pipelined function...
    SQL> create table treedata as
      2  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Adding Window Event Listener. Working with MDI.swf' as cp from dual union all
      3  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Finger Icon.swf' from dual union all
      4  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Key Icon.swf' from dual union all
      5  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Containing Information on Fingers.swf' from dual union all
      6  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Handling Shift Press.swf' from dual union all
      7  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 1).swf' from dual union all
      8  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 2).swf' from dual union all
      9  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyCode.swf' from dual union all
    10  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 1).swf' from dual union all
    11  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 2).swf' from dual union all
    12  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Key Systemization .swf' from dual union all
    13  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Saving Information on Keys.swf' from dual union all
    14  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating the Main Window (the Class MainWindow).swf' from dual union all
    15  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Class Constructor.swf' from dual union all
    16  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Fill.swf' from dual union all
    17  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 1).swf' from dual union all
    18  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 2).swf' from dual union all
    19  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 1).swf' from dual union all
    20  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 2).swf' from dual union all
    21  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Highlighting Icons.swf' from dual union all
    22  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method run.swf' from dual union all
    23  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method setVisible.swf' from dual union all
    24  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Registering Keyboard in the Main Window of Application .swf' from dual union all
    25  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\The Methods new_icon and new_fingericon.swf' from dual union all
    26  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Adding Keyboard Listener to the Application.swf' from dual union all
    27  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating Methods to Test the Efficiency of the User''s work.swf' from dual union all
    28  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class ExerciseGUI.swf' from dual union all
    29  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class Lessons and Working with It in the Class ExerciseGUI.swf' from dual union all
    30  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Handling Pressed Keys.swf' from dual union all
    31  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Improving Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    32  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Setting Position and the Sizes of the Main Window.swf' from dual union all
    33  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Statistics.swf' from dual union all
    34  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    35  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Keyboard Events.swf' from dual union all
    36  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Working with Main Window Menu. Positioning the Main Window.swf' from dual
    37  /
    Table created.
    SQL>
    SQL>
    SQL>
    SQL> CREATE OR REPLACE TYPE pth IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION tree RETURN pth PIPELINED IS
      2    l_maxlen      NUMBER;
      3    l_parent_path VARCHAR2(255);
      4    type t_output is table of varchar2(32767) index by pls_integer;
      5    l_output      t_output;
      6    l_cnt         NUMBER := 0;
      7    PROCEDURE show_children(p_path IN VARCHAR2, p_lvl IN NUMBER, p_tree IN VARCHAR2) IS
      8      l_ch_path_cnt number;
      9      CURSOR cur_children_elements IS -- non path children
    10        select replace(cp,p_path) as ch
    11        from   treedata
    12        where  instr(replace(cp,p_path),'\') = 0
    13        order by 1;
    14      CURSOR cur_children_paths IS -- path children
    15        select pth
    16              ,row_number() over (order by pth) as rn
    17              ,count(*) over () as cnt
    18        from (
    19              select distinct substr(replace(cp,p_path),1,instr(replace(cp,p_path),'\')) as pth
    20              from   treedata
    21              where  instr(cp,p_path) > 0
    22              and    instr(replace(cp,p_path),'\') > 0
    23              order by 1
    24             );
    25    BEGIN
    26      select count(*)
    27      into   l_ch_path_cnt
    28      from   treedata
    29      where  instr(cp,p_path) > 0
    30      and    instr(replace(cp,p_path),'\') > 0;
    31      for c in cur_children_elements
    32      loop
    33        l_cnt := l_cnt + 1;
    34        if l_ch_path_cnt = 0 then
    35          l_output(l_cnt) := replace(replace(substr(p_tree,1,length(p_tree)-2)||'  ','+',' '),'-',' ')||'  '||c.ch;
    36        else
    37          l_output(l_cnt) := replace(replace(p_tree,'+',' '),'-',' ')||'  '||c.ch;
    38        end if;
    39      end loop;
    40      if l_ch_path_cnt = 0 then
    41        l_cnt := l_cnt + 1;
    42        l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2);
    43      else
    44        l_cnt := l_cnt + 1;
    45        l_output(l_cnt) := p_tree;
    46      end if;
    47      for p in cur_children_paths
    48      loop
    49        if p.rn != p.cnt then
    50          l_cnt := l_cnt + 1;
    51          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'+-'||substr(p.pth,1,length(p.pth)-1);
    52          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'| | ');
    53        else
    54          l_cnt := l_cnt + 1;
    55          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'\-'||substr(p.pth,1,length(p.pth)-1);
    56          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'    ');
    57        end if;
    58      end loop;
    59    END;
    60  BEGIN
    61    -- first display the common parent path
    62    select max(length(txt)) as max_ln
    63    into   l_maxlen
    64    from (
    65          select substr(cp,1,rn) as txt
    66          from   treedata, (select rownum rn from dual connect by rownum <= 255)
    67          group by substr(cp,1,rn)
    68          having count(*) = (select count(*) from treedata)
    69         );
    70    select substr(cp,1,l_maxlen)
    71    into   l_parent_path
    72    from   treedata
    73    where  rownum = 1;
    74    PIPE ROW(l_parent_path);
    75    -- now recurse the data
    76    show_children(l_parent_path, 1, '| ');
    77    for i IN 1..l_cnt
    78    loop
    79      PIPE ROW(l_output(i));
    80    end loop;
    81    RETURN;
    82  END tree;
    83  /
    Function created.
    SQL>
    SQL> select * from table(tree);
    COLUMN_VALUE
    F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\
    |   Adding Window Event Listener. Working with MDI.swf
    |   Creating the Main Window (the Class MainWindow).swf
    |   Working with Main Window Menu. Positioning the Main Window.swf
    |
    +-Creating Supplementary Classes
    | |   Creating Finger Icon.swf
    | |   Creating Key Icon.swf
    | |   Creating the Class Containing Information on Fingers.swf
    | |   Creating the Class Handling Shift Press.swf
    | |   Creating the Class KeyCode.swf
    | |   Creating the Class for Key Systemization .swf
    | |   Creating the Class for Saving Information on Keys.swf
    | |
    | +-Creating the Class KBLayout
    | |     Creating the Class KBLayout (Part 1).swf
    | |     Creating the Class KBLayout (Part 2).swf
    | |
    | \-Creating the Class KeyIcon
    |       Creating the Class KeyIcon (Part 1).swf
    |       Creating the Class KeyIcon (Part 2).swf
    |
    +-KeyboardGUI
    | |   Class Constructor.swf
    | |   Creating Methods Responsible for Icon Fill.swf
    | |   Highlighting Icons.swf
    | |   Overriding the Method run.swf
    | |   Overriding the Method setVisible.swf
    | |   Registering Keyboard in the Main Window of Application .swf
    | |   The Methods new_icon and new_fingericon.swf
    | |
    | +-Creating Methods Responsible for Icon Highlight
    | |     Creating Methods Responsible for Icon Highlight (Part 1).swf
    | |     Creating Methods Responsible for Icon Highlight (Part 2).swf
    | |
    | \-Defining Some Static Variables
    |       Defining Some Static Variables (Part 1).swf
    |       Defining Some Static Variables (Part 2).swf
    |
    \-The Class ExerciseGUI
          Adding Keyboard Listener to the Application.swf
          Creating Methods to Test the Efficiency of the User's work.swf
          Creating the class ExerciseGUI.swf
          Creating the class Lessons and Working with It in the Class ExerciseGUI.swf
          Handling Pressed Keys.swf
          Improving Graphical Interface of the Class ExerciseGUI.swf
          Setting Position and the Sizes of the Main Window.swf
          Statistics.swf
          Working with Graphical Interface of the Class ExerciseGUI.swf
          Working with Keyboard Events.swf
    51 rows selected.
    SQL>

  • One to One mapping

    Hi,
    I have an object A having one to one relation with object B.
    Object A has these fields
    id - long
    name - String
    order - ValueHolderinterface (for object B)
    object B has these fields
    order_id - long
    order_type - String
    I am using ExpressionBuilder to query all objects of type A having order_id =some value say 1.
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression exp=null;
    exp=builder.get(?).likeIgnoreCase("1");
    What should I use as attribute name, that is in the place of "?" for querying based on order_id.
    Appreciate any help.
    Thanks
    Priya

    Hi,
    Assuming the fields you've given are the variable names in the class (as opposed to the database columns), it'd be:
    exp = builder.get( "order" ).get( "order_id" ).equal( "1" );
    And then you'd query with A.class as your reference class, like
    session.executeQuery( A.class, exp );
    Greg

Maybe you are looking for