Select some attributes with criteria api

Hi,
How can I specify more than one attribute here:
query.select((Selection<? extends E>) root.get("name"));
in other words, how can i get this query with criteria api "select name, second_name from Person" ?
Thank you!

Hi,
How can I specify more than one attribute here:
query.select((Selection<? extends E>) root.get("name"));
in other words, how can i get this query with criteria api "select name, second_name from Person" ?
Thank you!

Similar Messages

  • TextField  javascript: select some Text with selStart/selEnd

    Hi,
    I try to preselect some text content within a TextField via javaScript.
    I found some documentation, which states that in the change-Event I could set the selStart and selEnd Attributes by a script.: When a change or full event occurs, if characters were selected in the field, selStart and selEnd
    are set to bracket the selected characters.
    I tried this, but it did not work for me.
    Any Ideas on how to preselect some text in a TextField by script?
    Many thanks in advance

    I solved this same issue by using a switch script.
    Please see my earlier thread regarding this and Paul's example will provide you with the proper scripting for a switch script.
    http://forums.adobe.com/thread/479021
    script on the drop down list as follows
    switch (this.rawValue) {
         case "dropchoice1"
              fieldname1.rawValue = "text choice here";
              fieldname2.rawValue = "text choice here";
              break;
         case "dropchoice2"
              fieldname1.rawValue = "text choice here";
              fieldname2.rawValue = "text choice here";
              break;
    Good luck.

  • XPath selection Problem - Attribute with value ???

    Hi All,
    I am having the following xml and i need to retrieve the value "1.23423" from the xml...I tried with the following XPath but couldn't achieve..
    String xpath = "//Attribute[@name='SegmentDelimiter']";
    Can you please help me ??
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:Sample xmlns:xs="http://kathir.com" xs:version="1.0" xs:build="20805" xs:jvmVersion="1.1.1">
    <xs:Test>
    <xs:Source xs:id="FIRST">
    <xs:Attribute xs:name="structure" xs:value="sample.xml" />
    </xs:Source>
    <xs:Target xs:id="SECOND">
    <xs:Attribute xs:name="FirstFormatter" xs:value="sample2.xml" />
    </xs:Target>
    </xs:Test>
    <xs:Testing>
    <xs:Properties xs:name="SecondFormatter" xs:id="sample3">
    <xs:Attribute xs:name="indent" xs:value="4" />
    </xs:Properties>
    <xs:Properties xs:name="ThirdFormatter" xs:id="sample4">
    <xs:Attribute xs:name="FormattedValue" xs:value="1.23423" />
    </xs:Properties>
    </xs:Testing>
    </xs:Sample>
    Thanks,
    J.Kathir

    nothing to do with java!
    find an Xpath forum, or try http://www.w3schools.com/xpath

  • Sorting on one-to-many relationship with JPA criteria API

    I'm having some trouble using JPA criteria API with collection references.
    I have an entity called Competence that has a one-to-many relation to CompetenceName that contains names for Competence for several languages.
    [Competence.java]
    @OneToMany(mappedBy="competence", cascade=CascadeType.ALL, orphanRemoval=true)
    private List<CompetenceName> competenceNames;
    [CompetenceName.java]
    @ManyToOne @JoinColumn(name = "competence_id", referencedColumnName = "id")
    private Competence competence;
    @ManyToOne @JoinColumn(name = "lang_id", referencedColumnName = "id")
    private Language language;
    @Basic @Column(name = "name", length = 50)
    private String name
    Now I want to load 200 Competence-entities and sort them by their name (depending on the language of the logged in user). How would this be done using the JPA Criteria API? With a normal query, I would accomplish this with
    "SELECT DISTINCT c FROM Competence AS c LEFT JOIN c.competenceNames AS cn ORDER BY cn.name"
    Obviously, CompetenceName could contain zero entries for a Competence, but it works anyway with a normal query. With criteria API, it would look something like:
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    competence.fetch(Competence_.competenceNames);
    cq.select(competence).orderBy(cb.asc(competence.get(Competence_.competenceNames).get(CompetenceName_.name)); // Doesn't work
    Is this even possible to do without creating a normal query?
    Edited by: 812655 on Nov 24, 2010 2:32 AM

    // Doesn't workWhat does not work? What error do you get?
    You need to use "join" to define a join.
    CriteriaQuery<Competence> cq = cb.createQuery(Competence.class);
    Root<Competence> competence = cq.from(Competence.class);
    Join<CompetenceName> name = competence.join(Competence_.competenceNames);
    cq.orderBy(cb.asc(name.get(CompetenceName_.name));
    The "fetch" will do a fetch join, if you also wish to load the data in the same query.
    James : http://www.eclipselink.org

  • Problem creating in some attribute options for class through java API

    Hello everyone,
    I am successfully creating class and its attributes but i am not able to create attributes with its option like IS REQUIRED, IS INDEXED, IS SETTABLE and READ ONLY.....
    public void create_class(String cname,String cdesc,String scname)
    try
    ClassObjectDefinition cod = new ClassObjectDefinition(csession);
    cod.setSuperclassName(scname);
    cod.setName(cname);
    ClassObject co = (ClassObject)csession.createSchemaObject(cod);
    AttributeDefinition ad2 = new AttributeDefinition(csession);
    ad2.setAttributeByUpperCaseName("NAME",AttributeValue.newAttributeValue("Divya"));
    ad2.setAttributeByUpperCaseName("DATATYPE",AttributeValue.newAttributeValue(Attribute.ATTRIBUTEDATATYPE_STRING));
    ad2.setAttributeByUpperCaseName("DATALENGTH",AttributeValue.newAttributeValue(151));
    ad2.setAttributeByUpperCaseName("DESCRIPTION",AttributeValue.newAttributeValue("This the attribute number 2"));
    //here is some problem,,, Is Required is not been able to set
    //ad2.setAttributeByUpperCaseName("REQUIRED",AttributeValue.newAttributeValue(true));
    co.addAttribute(ad2);
    catch(IfsException e)
    e.printStackTrace();
    }

    Hi Kabilesh,
    Could you please let me know the exast soution u had for this?
    I even set the SHLIB_PATH in the environment, but still this problem persists.
    I am compiling the program and making into a shared library as
    cc -c -g -n +z -I$JAVA_HOME/include -I$JAVA_HOME/include/hp-ux -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm Test.c -o Test.o
    ld -b Test.o -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm -o Test.slMy java code is looks like this :
    void create_Jvm()
        JNIEnv * env;
        JavaVM * jvm;
        //JDK1_1InitArgs vm_args;
        /* Note : In JNI1.2 and Java2 SDK 1.4, the new structure JavaVMInitArgs has been introduced.*/
        JavaVMInitArgs vm_args;
        //JavaVMOption options[1];
        jint res;
        vm_args.nOptions = 0;
        vm_args.ignoreUnrecognized = JNI_TRUE;
        /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
        vm_args.version = JNI_VERSION_1_4;
        //vm_args.version = JNI_VERSION_1_2;
        /*In JNI1.2 and Java2 SDK 1.4 the JNI_GetDefaultJavaVMInitArgs method call is not required.*/
        //JNI_GetDefaultJavaVMInitArgs( & vm_args);
        res = JNI_CreateJavaVM( &jvm, (void**)&env, &vm_args);
        if (res < 0) {
            fprintf(stderr, "Can't create Java VM\n Error is :%ld\n ", res);
            exit(1);
        iJvmInitialized = 1;
    } hi
    Check the lib path
    May be u have not included : at the end of the lib
    path that u have added
    THis was the mistake that i did
    kabilesh

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • ADF BC : "Attributes selected in query with no column type found! ..."

    hi
    Using JDeveloper 10.1.3.3.0, I have this "Selected in Query" attribute, "Never" updatable, in my Entity Object.
    The Entity Object is based on the SCOTT.EMP table and the attribute, called "BonusInfo", is defined using the expression " '[bonus info ' || (SAL * 2) || ']' ".
    see http://verveja.footsteps.be/~verveja/files/oracle/NoColumnTypeFoundApp-v0.01.zip
    While creating this Entity Object, I got a "Business Components" dialog that says:
    "Column type is not specified for this attribute. Specifying column-type and precision results in better query performance at runtime. Do you wish to set column type to VARCHAR2(255)?"
    I clicked "Yes".
    I also created two View Objects based on this Entity Object.
    In the "Create View Object" wizard "Step 4 of 7: Attribute Settings" I got a "Business Components" diaglog that says:
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    I clicked "Yes".
    Testing the query in "Step 5 of 7: SQL Statement" showed "Query is valid.".
    question:
    Why do I keep getting the message ...
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    ... in the View Object Editor if I click on different attributes?
    (I don't get such a message the first time I click on an attribute after opening the View Object Editor, but after that it keeps popping up each time I click on a different attribute, no matter what I answer "Yes", "No" or "Cancel".)
    many thanks
    Jan Vervecken

    Jan,
    BC needs the column type and precision so that we can allocate the correct JDBC buffer size; otherwise we would just allocate 2k per string.
    Blaise

  • Attributes selected in query with no column type found! (solved)

    Dear JHeadstart Team,
    In the view object Editor I have two entity based attributes attrib1 and attrib2
    both with type Number. Both have aliases with type number(9,0)
    If attrib1 is null I want to have the value of attrib2.
    In the expression box I put: nvl(attrib1,attrib2)
    When I press the ok button I get the next error message.
    "Attributes selected in query with no column type found!
    Specifying column-type and precision results in better query performance at runtime.
    Do you wish to set default column type for these attributes? "
    When I say ok I get the next message:
    "An error occurred. Unable to apply all the wizard changes.
    Column type cannot be changed for Entity based attribute.
    Exception: oracle.jbo.dt.objects.JboExeption."
    The details button serves no extra information.
    Since both the attributes have the same type I thought the nvl commando should work.
    But what does the "no column type found" sentence mean?
    regards,
    Marcel.
    Message was edited by:
    user571204

    Thanks Jan,
    You've put me on the right track.
    I found out that this is only possible in the entity object class.
    So I have to check my limited java skills.

  • For some reason, my compression option is grayed out under "File" menu, and when I select a folder with multiple files, or multiple documents, and try to right-click or tap the mousepad with two fingers, I do not get a "compress" option available. Help.

    I don't know why, but when I select a folder with multiple docs contained within it, or multiple files, the Compress option is grayed out under the File menu, nor is it available when I right-click. Please help.

    Yes it is, but I have the same problem of the option does not appear with "right click" (I'm actually control-clicking), and COMPRESS is grayed out under the file menu. I'd like to fix it.
    Hmm. After finding the Archive Utility,* I tried archiving the folder. It came out as .cpgz, ugh. Found there was a preference to make .zip the default. It worked!
    And now…the menus are not grayed out. ?!?! OK.'
    Hope this helps someone.
    *You cannot find this via search, apparently it is a hidden file, you have to click from the root drive through to /System/Library/CoreServices (Thanks for the file path Alberto!)

  • ADF BC Attribute with VC of CONTAINS Ignores Choice List on the LOV

    JDev 11g PS 1.
    Objects:
    - A view criteria with attribute defined as CONTAINS (literal)
    - An LOV on that attribute with a default list type UI hint of Choice List
    - ADF Faces query-table based in the VC
    Problem: query-table ignores the Choice List and renders an Input Text.
    Clue: Changing the operator to EQUALS causes the expected Choice List to be rendered in ADF BC.
    If this is documented in the online help or in this forum, it is escaping me.
    Anyone know the best workaround? Set the VC using EQUALS and switch it to CONTAINS in buildWhereClause() maybe?
    Thanks,
    Peter

    Frank,
    Thanks for the fast reply and for the bug entry. Unfortunately stopping work is not an option. We've come up with a solution using a query listener that replaces EQUALS with CONTAINS before the query and resets it to EQUALS after the query (otherwise the component draws the text item after the query).
    Maybe you can think of another solution to our requirement: display a single master record in the results table for a master-detail database view. For example, in an altered Oracle HR world, each DEPARTMENTS record is associated with multiple LOCATIONS records (through a DEPT_LOC table). A database view, DEPT_LOC_VW, based on that table also contains the location description and department description.
    Users want to select and then edit (on another page) a department by querying by location. If we represent DEPT_LOC_VW in the query-table component, we see multiple result rows for a single department and that is unnecessary confusion for the purpose of editing a single department.
    So we have created an alternative database view, DEPT_VW, based on DEPARTMENTS only, with an additional column -- LOC_LIST -- based on a function that returns a delimited list of all location codes for that department. This way, the user sees only one department record in the results table (although we lose the location description in the results -- not an issue) and is still able to query based on location.
    A LOCATIONS_VW view contains the location code surrounded with the delimiiter. The DeptVw view attribute LocList contains an LOV based on that database view.
    We want the view criteria to create a query condition:
    WHERE loc_list LIKE '%'||<selected location code>||'%'We thought about some kind of clever use of a subquery using a bind variable:
    SELECT...
    FROM  departments -- not DEPT_VW or DEPT_LOC_VW
    WHERE department_id IN (
       SELECT department_id
       FROM   dept_loc
       WHERE  location_id = NVL(:userSelectedLocationId, location_id);But that bind variable does not show in the view criteria selection list so it will not appear in the query component.
    Thanks again,
    Peter

  • Bug in Entity Framework: No rows returned with criteria.

    Bug: Oracle fails to return rows with lambda criteria on string field from varchar2 column in view.
    Steps to reproduce:
    Create view:
    CREATE OR REPLACE VIEW "PHILIP_TEST" ("ROWNUMBER", "DRIVER") AS
    SELECT
         ROWNUMBER,
         DECODE(DRIVER,CHR(2),NULL,DRIVER) DRIVER
    FROM FLIGHT
    WHERE SCHEDULEDDATE = TRUNC(SYSDATE);
    Rownumber is unique key (number), Driver is varchar2(7).
    Create C# console application in VS2010
    Add Entities Model and add view.
    Add this code to Main()
    var context = new Entities();
    // Test code start
    var allrows = context.PHILIP_TEST.Where(x => x.DRIVER != null).ToArray();
    Console.WriteLine(allrows.Count());
    // Select first driver as criteria
    var driver = allrows[0].DRIVER;
    Console.WriteLine(driver);
    // Test code end
    // This line fails to return any rows
    var result = context.PHILIP_TEST.Where(x => x.DRIVER == driver).ToArray();
    Console.WriteLine(result.Count());
    Console.ReadLine();
    Add some test data to flight.
    Run it!
    The expression with criteria x.DRIVER == driver should return at least 1 row. It doesnt.
    Running the following from SQL Developer returns records: Conclution the view is fine.
    SELECT * FROM PHILIP_TEST WHERE DRIVER = 'MJA'
    If definition of DRIVER column in view is changed from: "DECODE(DRIVER,CHR(2),NULL,DRIVER) DRIVER" to just "DRIVER", then code returns rows as expected.

    are you sure your two select statements can't be combined to one query with outer join?
    if the outer join is possible, after creating the query, it will have one group with all the fields/columns you selected.
    drag the columns you selected in the personal info, outside the group.
    this should enable you to have one query with two groups, a master (personal info) and a detail (monetary calculations).
    your first frame will have the master group as source, while for the second the detail. now, the "Value if Null" should work.
    if the outer join is not possible,
    create one query with only the personal info. in the group, create column formula to get the monetary columns (you may need to create place holders if selecting multiple columns)
    drag the columns you selected in the personal info, outside the group.
    this should enable you to have one query with two groups, a master (personal info) and a detail (monetary calculations, you CF_ and CP_ columns).
    your first frame will have the master group as source, while for the second the detail. now, the "Value if Null" should work in your CF_ and CP_ columns

  • Selecting XML attributes?!

    Hi all!
    First post at here.
    I'm working on a project and i have a menu that works with
    data loaded from a xml file. It is a carousel and by clicking the
    icons it is supposed to open some few things.
    The problem is, some of them are movie clips and other are
    .exe files (i'm thinking in opening them with fscommand "exec" from
    a projector) and i want to know if there is any way to select the
    attributes, so that, in example, if it is an exe file to open a
    folder or something it uses fscommand and if it is a swf file it
    loads it in an empty movie clip on the stage.
    I attached my xml...file is the supposed file to load/open,
    image is the icon and i have also tooltips to them...And also the
    essential AS code (i think)...
    I would be really glad if someone could help me...I need to
    finish this as soon as possible.
    Thanks in advance

    Hi all!
    First post at here.
    I'm working on a project and i have a menu that works with
    data loaded from a xml file. It is a carousel and by clicking the
    icons it is supposed to open some few things.
    The problem is, some of them are movie clips and other are
    .exe files (i'm thinking in opening them with fscommand "exec" from
    a projector) and i want to know if there is any way to select the
    attributes, so that, in example, if it is an exe file to open a
    folder or something it uses fscommand and if it is a swf file it
    loads it in an empty movie clip on the stage.
    I attached my xml...file is the supposed file to load/open,
    image is the icon and i have also tooltips to them...And also the
    essential AS code (i think)...
    I would be really glad if someone could help me...I need to
    finish this as soon as possible.
    Thanks in advance

  • F110 How to select some line items form Proposal to pay.

    Hello
    I have create a proposal and extract text file with all customers and their checks,
    after that i need to select some items from proposal to pay , not all proposal items.

    Hi Yasser.
    If I understand well, you want running a proposal only for few selected items ok?
    For that you need select open items:
    Go to Tcodes: FBL3N or FBL5N, choose the documents numbers of the open items
    Go to Tcode F110  "Free Selection"   > "Selection Criteria" in  "Field Name" select "Document Number". then put the documents numbers of open items there. So,  the select items will be in the proposal.
    Example
    Kind Regards
    Jandoval Nascimento

  • Need some help with computation

    Hi, I need some help with the following:
    My page 3 is a form thats shows, among other things, a document ID (:P3_DOC_ID). Next to this item I have created a button that calls a document selection form (page 10).
    On selection this forms sets 2 items:
    P10_SELECTED (Y or N)
    P10_DOC_ID (the selected documents ID value)
    When the user selects a document he returns to the calling form.
    On page 3 I now try to capture the selected values. For a test item I managed to do this by defining this items source as:
    [PL/SQL function body]
    begin
    if V('P10_SELECTED') = 'Y'
    then
    return V('P10_DOC_ID'); -- selected value
    else
    return V('P3_TEST'); -- else the original value
    end if;
    end;
    However I want P3_DOC_ID to capture the selected value. I tried using a computation but that did not work. Any ideas?
    thanks Rene

    You might want to check if the "Source Used" attribute for P3_DOC_ID is set to always or to "only when ..." it sounds like you need it set to "only when ..."
    If that does not work try this
    Place the following in a pl/sql anonymous block and turn off your
    computation.
    if :P10_SELECTED = 'Y'
    then
    :P3_DOC_ID := :P10_DOC_ID; -- selected value
    else
    :P3_DOC_ID := :P3_TEST; -- else the original value
    end if;
    Justin

  • Updating value of for taxonomy attributes via ABAP API

    Hi ,
    We have table Product hierarchy repository in that we have Products table and ProductHierarchy table which is of type taxonomy .
    The product hierarchy is assigned to each product as lookup taxonomy field.
    Can anyone please let me know how we can update the values assgined to the attribute throght ABAP API.
    Example we have the attribute called color which assigned to Product Hierarchy 'A' and this product hierarchy 'A' is attached to Material '111' and the attribute color will have value 'Blue' for material '111' now I want to update the value of color to 'Red' . How we can achieve this via the MDM ABAP API.
    Regards,
    Amar Kamat

    If your question is how to change the value of an attribute for a specific product this is the solution:
    Use IF_MDM_CORE_SERVICES->RETRIEVE( ) to retrieve the product record so that you have a populated structure of type MDM_PARAMETER. In this structure you will find the entry relating to the taxonomy field. The VALUE attribute of this line entry will be a reference to type MDM_TAXONOMY_ENTRY.
    At this point you will want to take the TAXONOMY_ENTRY_ID and TAXONOMY_TABLE_CODE of this structure to retrieve the attributes. Using IF_MDM_CORE_SERVICE->RETRIEVE_ATTRIBUTES( ) and the attributes mentioned before you will get the results into a table of line type MDM_ATTRIBUTE_INFORMATION_SL.
    Select the appropriate line from the result table based on the attribute name (ATTR_NAME). In the record of type MDM_ATTRIBUTE_INFORMATION_SL you will now want to select the appropriate line from the table found in field ATTR_FEATURE_DOMAIN. Find the appropriate attribute (in this case color) by VALUE_NAME and copy the VALUE_ID (type MDM_UNIQUE_ID).
    Now back to where we left off in the original record (MDM_PARAMETER), loop through the table found at field TAXONOMY_ATTRIBUTES of the MDM_TAXONOMY_ENTRY looking in ATTR_INFO for the correct ATTR_NAME. When the correct entry is found, update the ATTR_FEATURE_DOMAIN with the new VALUE_ID and viola, you've got a mdm record ready to be updated.
    Simply call IF_MDM_CORE_SERVICE-UPDATE( ) with the modified record and you've updated your attribute assignment.
    In short:
    Navigate to the MDM_TAXONOMY_ENTRY of the product record
    Retrieve the attributes from the corresponding taxonomy table and navigate to the unique ID of the desired attribute
    Navigate to the attribute within the record's MDM_TAXONOMY_ENTRY and update the VALUE_ID with the new unique ID
    Update the product record
    Regards,
    Brian Dennett

Maybe you are looking for

  • Wrong path changes in Itunes XML file

    hi there, My Itunes library (9.0.2) is stored locally on my macbook, although actual files are on a network attached storage that I access through AFP. This share is mounted automatically when the mac starts. Everything was working perfectly fine unt

  • In this case, can I modify swing GUI out of swing thread?

    I know the Swing single thread rule and design (Swing is not thread safe). For time-consuming task, we are using other thread to do the task and we use SwingUtilities.invokeAndWait() or SwingUtilities.invokeLater (or SwingWorker) to update Swing GUI.

  • When using "Database diff" selecting other schemas only for compare own objects are shown too!

    Hi! For comparing lot of objects I use a priviliged account z, which can read Schema a and b. In the compare dialog I set different from the Defaults following Options: - step 1 - option "Maintain" - step 3 - button "More" - select schema a - button

  • Linking tables from excel

    Do I understand this correctly: that if a linked Excel file is placed in InDesign and I style that content.. then update the original content, I can't hold the formatting I did in InDesign?!

  • XFI Extreme Music Prob

    My system is listed below in my Sig, My problem is a Strange one as My card seems to be working fine except for the fact of when I attempt to adjust my settings IE Creative Media Player. I Get an Error(No Hardware supporting this program) as if the S