Map complicated queries to attributes?

OK, well, I have a class which has a 1-many mapping. the queries for this are getting kinda complicated and I'm wondering if I can essesntially map the subqueries to a java property on the parent class.
In other words I have class A mapped one to many descriptor b.
I have several values for class b (call them 1,2,3). Sometimes, I need to know if something has a 2 but no threes. Sometimes I need to know if it has a 1 entry, but no 2s, etc. Some of these involve SQL subqueries. I'm wondering If I can map it to a propery in the java class and kind of "preMap" the sql/conditions to get certain status (i.e. a single property which returns-- this is read only -- it's 1, but no 2s, 2 but no 3s, etc.).
Is this possible? Should I use named queries and pre-build them that way? Any advice would be appreciated.

A bit more brute force... I.e.,
public class A {
public Collection b;
public Collection b1;
public Collection b2;
public void addB(B aB) {
aB.setOwner(a);
b.add(aB);
if(aB.value() = 1) b1.add(aB);
if(aB.value() = 2) b2.add(aB);
Of course, this is not a good idea if you have a lot of these different values, but given you were asking if you could somehow map them to a query, this doesn't seem that unreasonable...
- Don

Similar Messages

  • How to map single context value attribute to multiple value attributes?

    Hello,
    is there any way to map a single value attribute
    from view's context into several value attributes
    in controller's context?
    The business context of what I want to achieve
    is the following: I have a view which can be called
    in two modes: read only (RO) and read-write (RW).
    The input parameters to the view are the same for
    both modes, however when in RO mode, the view calls
    a different set of web services than when called
    in RW mode. Before calling each of the web services
    I need to populate their context value attributes
    with appropriate input values.
    I know I can do it in Java code, but is it possible
    to do it without any programming (doing it in the
    source code is prone to errors)?
    Any help highly appreciated.
    Greetings,
    Tomek.

    Hi Kishore,
    than you very much for your kind help.
    I have already created a value attribute of type
    boolean and mapped it into the read-only property
    of the UI elements. This however does not solve all
    of the problems... I will describe it with an
    example:
    Let's say the form I want to implement will be
    used to: create (read-write mode), update (read-
    write mode) or show (read-only mode) customer's
    data. The customer's data is complex (lots of
    data, including tree structures).
    The problem is that:
    - when the form is called in read-only mode,
      it should populate its fields with values
      provided by the getCustomerData web service,
    - when the form is called to create a new
      customer (in read-write) mode, it should
      not use the getCustomerData web service.
      Instead it should map the input values
      entered by the user into input parameters
      of the createNewCustomer web service,
    - when the form is called to update customer's
      data, it should first display values returned
      by the getCustomerData web service, and then
      it should map the modified values entered by
      the user into input parameters of the
      updateCustomer web service,
    In all the above cases I must map my view's
    context data to different controller's context
    elements. Doing it directly in the source code
    is not a nice solution. Is there any other
    way to achieve this? 
    Calling a form in different modes in not an
    unusual thing, so I was hoping that maybe
    there are any built-in mechanisms that would
    solve the obove problem...
    Greetings,
    Tomek.

  • How to map complex queries to ADF

    I have an SQL query that I would like to map to ADF business components but am having difficulty.
    The query is:
    SELECT ENTA.KEYA, ENTA.ATTA1, ENTB.ATTB1 FROM ENTA, ENTB WHERE (ENTA.KEYA = '?') AND (ENTA.ATTA2 = ENTB.KEYB) AND (ENTA.ATTA1 BETWEEN ? AND (SELECT MIN(ENTA.ATTA1) FROM ENTA , ENTB WHERE (ENTA.ATTA2 = ENTB.KEYB) AND (ENTB.ATTB2 = 'D') AND (ENTA.KEYA = '?') AND (ENTA.ATTA1 >= ?)))
    I don't know if I should use one view object for the inner query or one view object for the whole query. Whatever I try I still have problems with the ViewLink.
    To make matters more complicated parameters 1 and 3 are identical as are parameters 2 and 4.
    Can anyone help?

    Stephen,
    if the problem is that you cannot execute the query in teh BC4J tester, then this is because it doesn't support testing with parameters.
    Another way of doing what you want is to create two EO and then have the VO select the attributes from both. However, to do the filtering you still need to add parameters to the query.
    Frank

  • Sql for  inheritance mapping looks for inherited attributes in base table

    i don't know if it is my mistake but....
    with inherited attributes (that worked OK in 10.1.3DP3) we are experiencing strange behavoir in that: the sql generated to retrieve implementors of a base class from a base table with additional attributes for subclasses read from joined tables is not valid.
    in 10.1.3DP3, the sql is correctly generated such that the attributes for subclasses are selected from the appropriate joined tables
    in 10.1.3DP4, the sql is generated such that all fields are selected from the base table, regardless whether these fields are mapped to the base class (base table) or subclasses (joined tables).
    what i expect to see is that the base table (usually aliased as t0) AND the joined table for reading subclasses (usually aliased as t1) are used in the sql statement.
    instead, all fields are selected from t0.
    i have included the generated descriptor code
    thank you very much in advance of any help here
    regards
    paul
    base class descriptor: 10.1.3DP3
    public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
         RelationalDescriptor descriptor = new RelationalDescriptor();
         descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
         descriptor.addTableName("ENRICHMENT_RULE");
         descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");
         // Inheritance Properties.
         descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
         descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
         descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");
         descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();
    base class descriptor: 10.1.3DP4
    public ClassDescriptor buildAbstractEnrichmentRuleDescriptor() {
         RelationalDescriptor descriptor = new RelationalDescriptor();
         descriptor.setJavaClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
         descriptor.addTableName("ENRICHMENT_RULE");
         descriptor.addPrimaryKeyFieldName("ENRICHMENT_RULE.ENRICHMENT_RULE_ID");
         // Inheritance Properties.
         descriptor.getInheritancePolicy().setClassIndicatorFieldName("ENRICHMENT_RULE.DROP_DOWN_IND");
         descriptor.getInheritancePolicy().setReadAllSubclassesViewName("ENRICHMENT_RULE");
         descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.TextEnrichmentRule.class, "N");
         descriptor.getInheritancePolicy().addClassIndicator(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class, "Y");
         // Descriptor Properties.
         descriptor.useNoIdentityMap();
         descriptor.setIdentityMapSize(100);
         descriptor.useRemoteNoIdentityMap();
         descriptor.setRemoteIdentityMapSize(100);
         descriptor.setIsIsolated(true);
         descriptor.setAlias("AbstractEnrichmentRule");
    sub class descriptor:
    public ClassDescriptor buildDropDownEnrichmentRuleDescriptor() {
         RelationalDescriptor descriptor = new RelationalDescriptor();
         descriptor.setJavaClass(com.aon.amp.beans.enrichment.DropDownEnrichmentRule.class);
         descriptor.addTableName("DROP_DOWN_ENRICHMENT_RULE");
         // Inheritance Properties.
         descriptor.getInheritancePolicy().setParentClass(com.aon.amp.beans.enrichment.AbstractEnrichmentRule.class);
         descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();
         // Descriptor Properties.
         descriptor.setIsIsolated(true);
         descriptor.setAlias("DropDownEnrichmentRule");
         descriptor.setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);
    ...and the exception/ SQL
    Problem details
    Internal Exception: java.sql.SQLException: ORA-00904: "T0"."DROP_DOWN_SQL": invalid identifier Error Code: 904 Call:SELECT t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_IND, t0.LABEL_EXPRESSION, t0.COLUMN_NUM, t0.ORDER_PRIORITY, t0.LABEL_NAME, t0.VALUE_EXPRESSION, t0.ENRICHMENT_RULE_TYPE_ID, t0.ENRICHMENT_RULE_ID, t0.DROP_DOWN_SQL FROM ENRICHMENT_RULE t0 WHERE (t0.ENRICHMENT_BASE_ID = ?) bind => [1] Query:ReadAllQuery(com.aon.amp.beans.enrichment.AbstractEnrichmentRule)

    Hello Paul,
    There is a difference in your descriptors that is causing the problem. In the DP3 descriptor, you have selected dontReadSubclassesOnQueries() option, meaning that queries to the base class will only return base class implementations.
    The DP4 descriptor instead has setReadAllSubclassesViewName("ENRICHMENT_RULE"), which is telling it that when a query is performed on the base class that TopLink should also return subclasses. It is also telling TopLink to do this in 1 query using the ENRICHMENT_RULE view table - this allows you to specify a view that joins all the inheritance tables. This option is good when you are using cursors and the like but still need to query on the base class to get the subclasses.
    Best Regards,
    Chris Delahunt

  • Multi-Message-split with ABAP mapping and adapter specific attributes

    Hi all,
    With <b>ABAP-Mapping I split 1 message to n messages</b>.
    So many files are generated in <b>file-Adapter</b>.
    Everything fine.
    But now I want the file names different using adapter specific attributes.
    It is not possible to use variable substitution and write the file name in payload because of receiver restrictions.
    I tried this with following similar coding in ABAP-Mapping:
    data: lt_records TYPE MPP_DYNAMIC_TAB.
          Loop.
          l_file_name = "payload-Inbound"-information
          ls_record-namespace = 'http://sap.com/xi/XI/System/File'.
          ls_record-name = 'FileName'.
          ls_record-value = l_file_name.  "l_file_name comes from inbound-payload
          append ls_record to lt_records.
         Endloop.
      CALL METHOD dynamic_configuration->set_all_records
        EXPORTING
          records = lt_records.
    If I start the interface I see in the monitoring the dynamic configuration with many entries for file-name in the the SOAP-Header mapping of the request message (following extract):
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Mapping der Request-Message
      -->
    - <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPAADDRESS.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPABROKERROLE.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACOMPANYSEGMENT.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACUSTOMERROLE.XML</SAP:Record>
    The result is that <b>all files have the same file name</b> (last entry in dynamic configuration).
    Is it possible to write the adapter specific configuration in ABAP-mapping <u>for every single result message</u>??
    Thank you for your help,
    Florian

    Hi Florian,
    I've a different idea...I dont think its a "right solution" but just another work around..it involves a BPM...
    In your ABAP mapping..set the dynamic config with as many variables as number of different messages...i.e. use the variables like 'FileName1', 'FileName2'...'FileName6' instead of 'FileName'. But use the same namespace 'http://sap.com/xi/XI/System/File'
    Call the above mapping in a BPM and capture the individual messages and set the attribute 'FileName' from the values of 'FileName1' to 'FileName6' accordingly using Message Mapping and then send the message using the 'Send' step.
    before you try this, try using the variable names 'FileName1' ...'FileName6' in the receiver adapters...enable the ASMS. <b>I know we need to select which variables from the dynamic config to be used by the adapter by specifically selecting 'FileName', 'Directory' etc...but just give it a try and see if it works..</b>
    Or..instead of using a BPM..you can combine Henrique's idea...use Adapter module to set the value for 'FileName' from variables 'FileName1'...'FileName6' accordingly.
    hope I'm clear..lemme know if you have any questions..
    cheers
    praveen

  • Database control does not map to an XML attribute

    Hi
    Im trying to execute a stored procedure that would return me an XMLBean. During this process, the database control returns me an XMLBean, but doesnt map the XML attributes if any contained in the XSD. All data is mapped to the elements only. Kindly let me if anyone knows how to resolve this to map to the attributes.
    Thanks
    Kishore

    Hi
    Im trying to execute a stored procedure that would return me an XMLBean. During this process, the database control returns me an XMLBean, but doesnt map the XML attributes if any contained in the XSD. All data is mapped to the elements only. Kindly let me if anyone knows how to resolve this to map to the attributes.
    Thanks
    Kishore

  • SAML - USer Principal mapped on a SAML attribute - How to do ???

    Dear security experts,
    I have configured on my weblogic platform a Sender vouches SAML profile.
    I am trying to map the UserPrincipal (the one I get from the webServiceContext in my web service) to a SAML attribute (different from the SAML subject).
    I have written a class that implement the interfaces SAMLIdentityAssertionNameMapper and SAMLIdentityAssertionAttributeMapper .
    Here is an overview of the simplified implementation :
    public String mapNameInfo(SAMLNameMapperInfo info, ContextHandler handler) {
    return "user2";
    public void mapAttributeInfo(Collection<SAMLAttributeStatementInfo> attribStmts, ContextHandler contextHandler) {
    Set<Principal> principals = new HashSet<Principal>();
    principals.add(PrincipalFactory.getInstance().createWLSUser("user1"););
    ((SecurityTokenContextHandler)contextHandler).addContextElement(ContextElementDictionary.SAML_ATTRIBUTE_PRINCIPALS, principals);
    After weblogic has loaded my SAML assertion, I can see in the log that my uibject has two User Principal : user1, user2. When I call getUserPrincipal in my webservice, I always get "user1". I need to get "user2".
    Why mapNameInfo() always has the priority ? Is it the good way to implement this mechanism ?
    Thanks for your help.

    Gyan:
    How is that possible? If you import the VOImpl inside EOImpl, the import statement is ok. But how would you use that? There is no findViewObject method? The OADBTransaction class that I can use has only findObject method that one can use and I tried that but wasn't successful. Shouldn't you have to import OAApplicationModule and a host of other classes? Is that even possible?
    I thought about the entity expert approach but I don't have a need to execute any query. I just need to refer to the view attribute from within the EOImpl. That's what I am looking for. If there is a way to refer to a view attribute from within the EOImpl without having to populate that attribute in a session/transaction variable that would be a better solution for me because there may be more attributes that I need from different VOs later on and everytime I need some VO attribute I don't have to create and populate a session/transaction variable.
    Please let me know if it can be done. Can you please elaborate more on your proposal? I really appreciate your time and help. Thanks!
    - Muzammil

  • Map optional elements to attributes

    Hi,
    I am mapping 5 optional elements to a element which has 2 attributes.  I simplified my map to only check 1 optional element and then my map looks like below:
    So I check if the element PruchseOrderNumber which is optional exists in the source. If that's true I use 3 value mappings to write the destination fields userfield, id and datatype.
    But when I test the map I get a lot of Output validation errors. They are:
    Output validation error: The required attribute 'id' is missing
    Output validation error: The required attribute 'datatype' is missing
    The output XML looks like below:
    The first instance is created where there is no PurchaseOrderNumber and the second instance is when there is a PurchaseOrderNumber. But the first instance already creates a closed tag userfield. How do I get rid of this tag so my output validations are gone?

    Hi Ronald,
    One way to get rid of the empty nodes in your map by using a custom functoid and use XSLT script mentioned in this article. 
    Remove empty nodes in BizTalk by using XSLT
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • XML Gateway Mapping of XML Element Attribute

    Hi:
    If an inbound XML message contains this tag:
    <STATUS CODE="100"></STATUS>
    is it possible to map the CODE attribute to a database column?
    I've been attempting to do this but I'm receiving this error: Element STATUS not complete, expected elements ''.
    Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I'll answer my own question here.  Found the section in the XML User Guide about mapping HTTP Error Responses (chapter 22 in the v6.1 pdf) and realized that the XML gateway had preconfigured settings to handle various error conditions.  Edited the error handling configuration for the specific Handler (rather than the global setting) and checked the box to allow the error to pass through the XML gateway.  Redeployed the subpolicy.

  • SQl Developer Where are Map View queries stored

    SQL Developer Latest Version, Linux 86_64, Oracle EE Latest Version.
    I have looked through a lot of docs, schema and files but cannot for the life of me figure out where these are being stored. Little help

    Hey there,
    Oh yes indeed. I work at a University and am introducing students to Oracle Spatial. The ability to be able to give the students, typically graduate students, a basic package of predefined map queries would be very helpful. Unless the file contains other information it would be nice to know just what file it is and that could simply be handed off with an instruction telling them where to drop the file.
    Also the way the select list is handled when editing / running those queries is a bit quirky.
    I don;t know if you saw my other post re: "Point data Display Size" ? I cannot seem to find a way to alter the size of a point when displayed and it really seems to bit kinda weird and mostly seems linked to the number of points being displayed. The work we do is purely road networks so we have lots of 'Links and Nodes" that we display ( like the complete Highway Network the SF Bay Area down to the street level at times ) and so displaying the Nodes as point data and the links as line strings between points is critical so the ability to size the elements for display is as well.
    Thanks for the reply!

  • Mapping of OID custom attribute to ovd attribute with different names

    Hi We have requirement where my oid attribute say attributename1 is to be mapped with OVD attribute attributename2.
    Is there any means by which i can do this mapping by default?

    use getAttributeValue()

  • Dataprovider loose mapping to queries and infoprovider after transport

    Hi Experts,
    I have collected all relevant query elements and work sheets and transported them into productive BI system. When executing the work sheets in BEx Analyzer, they simply don't work due to lack of variables. When I changed to design mode, I saw that my dataproviders are not assigned to queries / cubes. Does anybody have an idea what is wrong ? Did I miss something in transport ?
    Thanks !
    Regards,
    Max

    Hi,
    Are you transporting queries, work books and data providers at same time? Or data provides are already there in Prod system? If so check your transport is having correct Query elements and work books (you can check with technical names). Is the transport is successful (i.e. return code = 0)? Sometimes there may chances of all elements are not properly transported to production system.
    Thanks
    Riyez

  • Queries with attributes not opening through Citrix.

    Hi.
    Our users use Citrix to remotely logon to their system. They use SAP GUI 6.20.
    When they remotely use Citrix and run BEx (thorugh RRMX), and try to open a query having attributes in the rows, it gives them (eventually us also) multiple errors.
    First, a "Program Error Intercepted" window, saying "An unexpected type mismatch error occured in wdbrlog. 1 error is logged". The it asks to type in what we were trying to do.
    If we type something, it would take us a new window saying "Run-time error '-2147221499 (80040005)': Fatal Error - Terminating. If we press the OK button underneath, it takes us to another window (saying Microsoft Visual Basic on top and in the body says: "Run-time error '-2147221499 (80040005)", Automation Error : The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed."
    Then it closes the open query window.
    Then if we try to open that or any other query, it (as usual) prompt us for the name and password and even if we put the correct name and password, it does not recognize anything. We have to logoff from the Citrix server manually and totally and then only the system works.
    We are confused of why this problem should happen and would really appreciate your help.
    Thanks.

    Hello Isha,
    I hope this is not too late.
    I am not sure of the ITS version you are using: is it the ITS 6.20 (Standalone) or the Integrated ITS?
    Please consider SAP note 1058218.
    Let me know if I can help you further.
    All the best,
    Cristiano

  • AP_EXPENSE_REPORT_HEADERS_ALL attribute mapping to AP_INVOICES_ALL

    Hi,
    We need to have some values in AP_INVOICES_ALL in some DFF ( For example Attribute10 ) for invoices we import via expense express. When we update attribute10 of ap_expense_report_headers_all after import i dont see it in the ap_invoices_all table.
    What is the mapping of the ap_invoices_all attributes to the ap_expense_report_headers_all attributes.
    Please help.
    thanks
    Ramakrishna

    Hi,
    The Attribute Mapping must be exactly matching between AP & Iexp.
    For example, if you are having a DFF in iExpense called DFF1 (Attribute12-Expense Headers), then you need to create a Attribute in AP Invoice Headers with the same Attribute Number 12.
    If you are creating in Expenses Report Lines, the create in AP Invoice Lines category. Pls remember that Attribute No. must be same. If it is done, then data will move exactly from iExpense to AP when Expense Report Export program is run.
    The DFF Names need not be same.
    Regards,
    guru

  • Mapping attributes not under nodes

    Hi
    If I create an attribute in the component controller wihtout a node, then can it be mapped to a view?
    On trying to do so it gives an error.
    Thanks
    Pushpraj

    Hi Pushpraj,
    You cant map those attributes to a view from the component controller. You can only map node and its attributes
    Regards
    Sarath

Maybe you are looking for