Primary key based on multiple fields which are of a custom class type

Hello!
I have the following two classes.
public class Application
protected String appName;
protected Set moduleOptions = new HashSet(); //Set<ModuleOption>
public class Option
protected String name;
protected Application application;
Now, I need for Option to have a composite primary key based on both its
fields. How do I do this?
For starters, I just need a few hints on how this should be done in Kodo
because I already have this thing working in JPOX and that solution does
not map directly to Kodo. JPOX defines the OptionPK (primary key class)
to contain field ApplicationPK, and not Application. But Kodo does not
accept this because of a mismatch between fields in class and its primary
key class. (Not implying that Kodo should accept the same kind of
solution.)
Btw, I'm evaluating version 3.2.3.
Thanks in advance!

Viktor,
The typical Kodo pattern for doing this is to create a private field in
Option for each primary key in Application, map those fields as
primary-key (but not the field of type Application), and therefore put
those fields in the OptionPK. These fields should then be mapped to the
same columns as the Application reference. Then, set the primary key
fields to the same value as they are in the related object.
Kodo allows multiple fields to be mapped to the same column in the
database, and throws an exception if your actions would set the column
to different values. So, typically, this might look like:
public class Application
protected String appName; // I'm assuming that this is the PK
protected Set moduleOptions = new HashSet ();
public class Option
protected String name; // pk
protected Application application; // not pk
private String applicationAppName; // pk
public Option (String n, Application a)
name = n;
application = a;
applicationAppName = a.appName;
-Patrick
Viktor Matic wrote:
Hello!
I have the following two classes.
public class Application
protected String appName;
protected Set moduleOptions = new HashSet(); //Set<ModuleOption>
public class Option
protected String name;
protected Application application;
Now, I need for Option to have a composite primary key based on both its
fields. How do I do this?
For starters, I just need a few hints on how this should be done in Kodo
because I already have this thing working in JPOX and that solution does
not map directly to Kodo. JPOX defines the OptionPK (primary key class)
to contain field ApplicationPK, and not Application. But Kodo does not
accept this because of a mismatch between fields in class and its primary
key class. (Not implying that Kodo should accept the same kind of
solution.)
Btw, I'm evaluating version 3.2.3.
Thanks in advance!

Similar Messages

  • Problem with object view with primary-key based object identifier

    Hello!
    I met such problem.
    t1 is persinstent-capable class:
    class t1 : public PObject { .... };
    T1OV is object view, based on object table T1OT
    I1 is primary key of the table T1OT.
    Next code:
    t1* t = new (conn, "T1OV") t1(...);
    conn->commit();
    try
    t->markDelete();
    conn->commit(); // exception throws here
    Works fine if T1OV defined as:
    create view t1ov of t1 with object identifier default
    as select * from t1ot;
    And throws an exception
    "ORA-22883: object deletion failed"
    if:
    create view t1ov of t1 with object identifier (I1)
    as select * from t1ot;
    Such problem also occurs when object view is based on relational table/view (OID is primary-key based).
    Also it occurs when
    t->markModified() used insted of t->markDelete()
    I am using Oracle 9i second release for windows and
    MS VC++
    Thank You

    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_85a.htm#2065512
    You can specify constraints on views and object views. You define the constraint at the view level using the out_of_line_constraint clause. You define the constraint as part of column or attribute specification using the inline_constraint clause after the appropriate alias.
    Oracle does not enforce view constraints. However, operations on views are subject to the integrity constraints defined on the underlying base tables. This means that you can enforce constraints on views through constraints on base tables.
    Restrictions on View Constraints
    View constraints are a subset of table constraints and are subject to the following restrictions:
    You can specify only unique, primary key, and foreign key constraints on views. However, you can define the view using the WITH CHECK OPTION clause, which is equivalent to specifying a check constraint for the view.
    Because view constraints are not enforced directly, you cannot specify INITIALLY DEFERRED or DEFERRABLE.
    View constraints are supported only in DISABLE NOVALIDATE mode. You must specify the keywords DISABLE NOVALIDATE when you declare the view constraint, and you cannot specify any other mode.
    You cannot specify the using_index_clause, the exceptions_clause clause, or the ON DELETE clause of the references_clause.
    You cannot define view constraints on attributes of an object column.
    Rgds.

  • Creating Custom fields which are sales org dependent in Accounts Master

    Hello Experts,
    I want to create new custom fields in Accounts Master for sales and shipping.The component being used is BP_SALES.However when I try to create custom fields through AET, the new fields are added in the BUILHEADER context node.The problem with this is, its making the fields Sales Org independent.
    I want to add the fields which are sales org dependent( i.e. want to add the fields for the context nodes BUILSHIPPINGTERMS and BUILSALESARRANGEMENT).
    Please help me in this regards,
    Thanks and Regards,
    Rahim
    Edited by: Abdul Rahim on Dec 27, 2010 9:55 AM

    Hi Rahim,
    in general extension fields for Business Partner are only supported for the header fields (Table BUT000). Therefore the AET does not offer this.
    Table extension for BP sales data is supported by the AET beginning from CRM 7.0 eHP1. If you have this you can just create a 1:1 table enhancements and should be happy. If not I'm afraid that you would have to implement this manually.
    Using the Easy Enhancement Workbench (EEW) it would only be possible to create table extensions for the header and for relation ship but not for sales data.
    Regards Matthias

  • Multiple IDOCs based on multiple fields in File to IDOC mapping

    Hello Experts,
         I have a requirement to create multiple IDOCs based on multiple fields.
         Earlier my requirement is to create IDOCs based on ShipID (i.e., for every ShipID new IDOC...I achieved this).
         But now the requirement was to create IDOC based on two more fields like
    Source:
         ShipID1
         FieldA with value1 
         FieldB with value1
    Target :
         1 IDOC to create
    and If
    Source:
         ShipID1
         FiledA with Value2
         FiledB with Value2
         ShipID1
         FiledA with Value1
         FiledB with Value2
    Target:
         2 IDOCs based on FiledA
    Like wise IDOC should create for every change in FiledA and FieldB.
    If FiledA and FiledB has no changes then create IDOC based on ShipID
    please help me in achieving this as this is an urgent requirement.

    Hi Prasad -
    Just concat all the three fields - shipID1, FieldA and FieldB and
    remove contexts
    split by value (value changed)
    collapse contexts
    This way whenever there is a change in any of the above fields you'll have separate IDOC..

  • How to export fields which are rendered false from a page?

    Hi ,
    I have a requirement to export the data to excel, i am able to do it using export button.
    but the problem is i need to export the all the fields which are there in the VO query but some of them are not renderd on the page.
    Please suggest some solution for this.
    Thanks

    Hi,
    Can you add them in the page to formValueBeans and check the issue.
    Thanks.
    With Regards,
    Kali.
    OSSi.

  • How exclude multiple values which are not in sequence ( range )

    Hi Abapers,
    My Requiremnt is to exclude multiple values which are not in sequence  in selection screen.
    I want to restrict some values .
    please provide sample code.
    thanks & regards,
    Hari priya

    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    INITILIZATION.
    s_matnr-sign = 'E'.  " E means Excluding.
    s_matnr-option = 'EQ'.
    s_matnr-low = '1000'.
    append s_matnr.
    s_matnr-sign = 'E'.
    s_matnr-option = 'EQ'.
    s_matnr-low = '1500'.
    append s_matnr.
    s_matnr-sign = 'E'.
    s_matnr-option = 'BT'.
    s_matnr-low = '2000'.
    s_matnr-high = '3000'.
    append s_matnr.
    START_OF_SELECTION.
    SELECT * FROM MARA INTO TABLE itab WHERE mara IN s_matnr.
    the above s_matnr has values 1000,1500, 2000 - 3000.
    so the above code fetches all the values excluding 1000,1500 and between 2000 and 3000.
    Regards
    Bala Krishna

  • How to get the screen groups for the screen field which are on selectionscn

    hiiii Experts,
                   How to know the screen groups for the screen field which are on selection screen.
    Thanks and regards,
    kasyap

         NAME                                             PNPABKRS-LOW
            GROUP1                                             SEL
            GROUP2                                             DBS
            GROUP3                                             LOW
            GROUP4                                             180
    to get this use this:
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        if screen-name CS 'ABKRS'.
          BREAK-POINT.
        endif.
      ENDLOOP.

  • Detect the fields which are primary/foreign keys for each schema's tables

    Hello everybody,
    I'd like to know if it's possible to select a field in one of the dictionary tables to identify the fields of a table which are PK or FK in this one. I'd like to do this to generate the fields that I need to put in a technical design.
    Actually I have this (if it can help you to understand what I'd like to do) :
    select table_name "Table name",
    column_name "Physical field name",
    case when data_type = 'NUMBER' then data_type || '(' || NVL(data_precision,0) || ',' || NVL(data_scale,0) || ')'
    when data_type = 'VARCHAR2' then data_type || '(' || data_length || ')'
    else data_type
    end "Datatype",
    case when nullable = 'Y' then 'FALSE'
    when nullable = 'N' then 'TRUE'
    end "Not null",
    /* Here I'd like to retrieve TRUE or FALSE if the field to display is a primary key or not and the same for foreign keys*/
    from all_tab_columns
    where table_name in (select table_name
    from all_tables
    where table_name like '%project_name%'
    and table_name not like '%TMP%');
    Thanks a lot for your help,
    Florent

    Please investigate all_constraints and all_cons_colums.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm

  • With a wired keyboard and a 2014 iMac I cannot select multiple items which are not next to each other

    I have recently changed from Windows 7 desktop to a new iMac running Mavericks.  I have chosen a wired keyboard as I like  the usual Delete key function.
    I cannot find out how to select several items which are not next to each other (e.g. words in Pages).  The well known method in Windows, which is repeated in the the Apple Finder Help screen, does not work.  Would be grateful for advice

    Hi JBowfin,
    If I am understanding your question correctly, I believe that I have an article that will address this question for you:
    Mac OS X 10.0: Use Command Key to Select Multiple Items in List and Column Views
    http://support.apple.com/kb/TA20396
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • ALV fields which are not referenced to data dictionary table fields

    Hello,
    I am using function module reuse_alv_popup_to_select.
    How do I display fields in ALV which are not referenced to
    data dictionary table fields.
    I am showing 4 columns in alv out of which first column is checkbox
    and remaining 3 columns are from data dictionary and it works fine.
    Now I need to add one more column which is of type checkbox.
    I have added this field in my ITAB as flag(1) type C.
    When I add this flag field in the field catalog, I get exception.
    Regards,
    Vishal.

    Hey guys,
    Finally I got rid of such a stupid problem.
    There were no problem in the code.
    while assigning fieldname to field catalog I had given fieldname
    in lowercase.
    I changed it to uppercase and problem got solved.
    Thanks,
    Vishal.

  • How to select multiple nodes, which are not next to each other,  in a tree?

    The following code suppose to allow user select any combination of nodes (because of DISCONTIGUOUS_TREE_SELECTION), however, I can only select nodes which are next to each other. Can some one told me how to make this DISCONTIGUOUS_TREE_SELECTION work?
    Thank you very much!
    import javax.swing.*;
    import javax.swing.tree.*;
    public class TestTree extends JFrame {
    public TestTree() {
    super();
    setBounds(0,0,500,500);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JTree tree = new JTree();
    getContentPane().add(tree);
    TreeSelectionModel model = new DefaultTreeSelectionModel();
    model.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.setSelectionModel(model);
    public static void main(String [] args) {
    TestTree test = new TestTree();
    test.show();

    In Windows you hold down the Ctrl key while clicking on the nodes you want to select. Don't know the equivalent in other environments.

  • How to clear the form fields which are not rendered

    I have a creation form. There is a document_type list set up as a partial triger. When user change the document type, only the filed related to that document type will be rendered. This caused a problem when we need to clear the form . The input in the field which is not render won't be cleared when reset button is pressed. Can anybody give a sugestion on how to handle this?
    I tried to use the following function to clear the fields. It does not work since it get the list value before the list value change and clear the fields after the new field rendered.
    public void clear_action(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    System.out.println("test1");
    String coutcase = null;
    if(EL.get("#{bindings.Proxy.inputValue}") != null){
    coutcase = EL.get("#{bindings.Proxy.inputValue}").toString();
    System.out.println(coutcase);
    AttributeBinding a11= (AttributeBinding)getBindings().getControlBinding("INT_FNAM");
    AttributeBinding a12 = (AttributeBinding)getBindings().getControlBinding("INT_LNAM");
    AttributeBinding a13 = (AttributeBinding)getBindings().getControlBinding("TIT_PROG");
    AttributeBinding a14 = (AttributeBinding)getBindings().getControlBinding("T_OF_INT");
    AttributeBinding a15 = (AttributeBinding)getBindings().getControlBinding("NETWORK");
    AttributeBinding a16 = (AttributeBinding)getBindings().getControlBinding("IN_DATE");
    AttributeBinding a17 = (AttributeBinding)getBindings().getControlBinding("PE_FNAM");
    AttributeBinding a18 = (AttributeBinding)getBindings().getControlBinding("PE_IN_LNAM");
    AttributeBinding a19 = (AttributeBinding)getBindings().getControlBinding("WEBSITE");
    AttributeBinding a20 = (AttributeBinding)getBindings().getControlBinding("URL");
    AttributeBinding a21 = (AttributeBinding)getBindings().getControlBinding("INT_DATA");
    AttributeBinding a22 = (AttributeBinding)getBindings().getControlBinding("D_ACCESS");
    AttributeBinding a23 = (AttributeBinding)getBindings().getControlBinding("CASE_NUM");
    AttributeBinding a24 = (AttributeBinding)getBindings().getControlBinding("COURT");
    AttributeBinding a25 = (AttributeBinding)getBindings().getControlBinding("PLAIN");
    AttributeBinding a26 = (AttributeBinding)getBindings().getControlBinding("DEFEN");
    if(coutcase.equals("Interview")) {
    a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    /*a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else if(coutcase.equals("Internet")){
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);*/
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    /*a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else{
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);*/
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);
    }else{
    System.out.println("coutcase is null");
    }

    Hi,
    The easiest way to modify the screens in the Std transactions using ITS is to modify the ITS templates corresponding to that transaction.
    E.g In you case,there will be a ITS service corresponding to the ESS transaction.This ITS service will have  number of HTML templates which will actually correspond to the diffrent screens in the Trascn.What you need to do is find out the HTML template in the ITS service which corresponds to the screen(which you want to modify) in the STd transacn.To do this ,the easiest way is to right click on that Web page and say VIEW SOURCE.It will show you a HTML code with the ITS service name and the template which is being used for that particular screen.
    So after you find out the correct HTML template to be modified,you can simply hide the fields by putting the HTML code lines in between the symbols
      <!   and  -->
    BR,
    Disha.
    <b>Pls reward points for useful answers.</b>

  • Fields which are possible 4 change in a service entry sheet after approval

    Dear Guru's,
    I find that after a service entry sheet is approved (automatic GR is done at this stage as well), there is not even 1 field which can be changed. Is there a way to make some fields changeable without going through the reversal process or cancelling the GR and cancelling the approval in the service entry sheet? Im looking to change the Header Short Text (Field Name = TXZ01). Is this possible ?
    Thanks in advance..

    Hi,
    After approval of a SES, no changes can be done further.  if you want to make any changes first reverse the acceptance. 
    regards
    alexandro

  • How to identify fields which are fast approaching the size limits

    Hi All,
    Is there an easy (or any) way of identifying Database fields whose field sizes are close to the limits.
    Example: I have field called SEQ_NUM, size of the field is 3 and currently latest value in the filed is 995, soon it will be a 1000.
    Thanks
    Raghu

    Hi, Raghu,
    Assuming your statistics are up to date, you can start with the information in the data dictionary view user_tab_columns (or all_tab_columns, or dba_tab_columns).
    The column high_value is a RAW representing the highest value. There's a conversion function in the supplied package utl_raw.
    The column data_precision is the maximum number of digits, and data_scale is the number of them to the right of the decimal point
    SELECT     table_name
    ,     column_name
    ,     utl_raw.cast_to_number (high_value)     AS actual_high
    ,     POWER (10, data_precision - data_scale)     AS possible_high
    FROM     user_tab_columns
    WHERE     data_type     = 'NUMBER'
    AND      ( utl_raw.cast_to_number (high_value)          -- actual_high
          / POWER (10, data_precision - data_scale)     -- possible_high
          ) > .95      -- or whatever
    ;I'm sure there are lots of special cases (large negative numbers, for example) that this will not catch.

  • Field to add to enter number of items which are  shipped to customer

    Hi Sap Experts,
    We have scenario, we have created sales order with quantity 1(Like soft copy or hard copy of CD).
    Now we want to create delivery with sales order and quantity is 1(Copy from sales order).
    Our requirement is some time we have to send additional things like hard copy of manual or complement gift which we are not entering in sales order.
    Exp: Sales order- quantity 1.
    Want to deliver quantity 1(+ manual+ complement gift, these items are not part of standard order)
    For more clarity, we have to add one field and want to enter number (How many items we have send along with main materials and these items are not relevant for pricing also).
    So requirement is add one additional field in delivery header/item.
    Customer doesn’t want to use Free of goods or BOM which we have propose him. How to customize standard table and standard program.
    Kindly suggest.
    Regards,
    Kotli
    20

    Hi,
    Thanks.We want to add a field, might be like this.We just want to enter only no of extra items like 3.
    Exp.
    Delivery Qty-1
    extra items:3
    Regards,
    Custom field to add number of packages shipped along with Delivery 

Maybe you are looking for

  • How to downgrade from beta 8 to 1.1.4??

    Hi! I have a paid iPhone Developer account with beta 8 of the firmware installed. Now that I'm selling my iPhone, I need to downgrade it to 1.1.4. The problem is that I'm unable to restore 1.1.4 through iTunes 7.7. I get a error code of 20?? I also t

  • My own Google Map icons are not visible in Firefox 8

    I have many Google Maps on my website and they contain both default Google icons and my own icons, each with their own URLs. They work correctly in all other browsers, and Firefox 7. However, yesterday I loaded Firefox 8. In Firefox 8 the Google defa

  • How do I add PHP Script to an XHTML Page?

    I am tring to add a PHP script to my XTHML page in Dream Weaver. The tag starts <?php and ends ?>. I have uploaded the script on to another site which I use for testing and it shows the whole code not the intended presentation. I did read that the se

  • Video ipod and nike+

    are fifth generation video ipods compatible with nike+ ipod sport kits??

  • My yahoo tool bar wont open on firefox 4.0

    when i open firefox my yahoo tool bar isnt visible and the refresh button does not work