Composite Key Validation in EOImpl

Hello,
Please anyone can give example of how to validate composite key validation?
I have tried by following in EOImpl code but its not working:
OADBTransaction transaction = getOADBTransaction();
Object[] ItemKey = {getOrganizationId(),getUserId(),getProcess()};
EntityDefImpl def = XxEOImpl.getDefinitionObject();
XxEOImpl item_name = (XxEOImpl)def.findByPrimaryKey(getOADBTransaction(),new Key(ItemKey));
if (item_name != null)
throw new OAException("Erorr duplicate");
Please suggest its urgent..
Thanks,
Swati Thakkar

Hello Gurus,
Can you please suggest the following way of validation is correct or not!?
We have defined primary key on 3 attributes as a composite key, created EO and VO.
Now to add new row we are asking values from user using LOV values.
is the handling of unique value constraint using TooManyObjects Exception valid approach to handle error?
EOImpl Code:
try {
setAttributeInternal(PROCESSTYPE, value);
} catch (TooManyObjectsException toomany) {
throw new OAException("Value is already exist.");
Please suggest the right approach to handling Composite key validation..
Thanks,
Swati

Similar Messages

  • Validations in EOImpl.java

    we have adddetails.jspx page with 5 fields and a commit button in which aid is the primary key field.And we did validations in EOImpl.java file for all the fields.
    when any one of the field validation fails and then if we goto home page and come back to adddetails.jspx page and then even if we enter values correctly it is showing error saying aid already exists.
    we even tried VO.clearcache(entityname,true) in backing bean.
    Here the point is when any one of the field validation fails and if we enter values correctly with out going to home page and coming back to adddetails.jspx it is working fine.

    Muralidaran,
    What's wrong with default validation? I.e. validation available via set of constraints for your own SimpleType in LocalDictionary?
    If it's not sufficient you may try something like this: /people/valery.silaev/blog/2005/11/29/800format-your-way (here I were talking about formatting, but validation was used as well, implicitly
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • When i try to install iPlanet App Server on NT, I do not get screen to enter license key valid for evaluation. --- " cache File Read error"

    When i try to install iPlanet App Server on NT, I do not get screen to enter license key valid for evaluation.
    Also during installation screens an error window is displayed saying "cache File Read error -- Could not read ProductKey entry from the cache file "

    Hi,
    I also get the following message:
    "Could not read ProductKey entry from the cache file"
    I have no idea how to provide the installation software with the key. I also tried "keycheck.exe"
    Do you have a solution for this problem? Did you finish the installation?
    Christian

  • Composite Key in Toplink Mapping File - equivalent to Hibernate?

    Hi,
    I have a POJO TestEntity which refers to primary key TestEntityKey. In Hibernate mapping hbm file, we define the entry as:
              <composite-id name="id" class="TestEntityKey">
                   <key-property name ="testEntityCode" column = "TEST_ENT_CODE" type = "string" />
              </composite-id>
    Please confirm how to create the composite id in Toplink means kindly help that how to map my id to key:
    <opm:primary-key>
         <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

    Hey.. Thanks!
    I am clear about the concept about defining annotation based composite key. Also, I read in the documentation that I'll be needing to define as direct, aggregate or one-to-one. But, I am not able to define and run the same in the project mapping xml of toplink.
    It would be great if you can share some sample code for defining the same. For e.g. in my mentioned example, there is TestEntity POJO having 'id' as the attribute which gets populated with the testEntityCode of the TestEntityKey POJO. Please suggest the same for the same:
    <opm:primary-key>
    <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

  • Composite key field is not a simple type or enum

    According to the docs here - http://www.oracle.com/technology/documentation/berkeley-db/je/java/index.html?com/sleepycat/persist/model/PrimaryKey.html - you can use "A composite key class containing one or more simple type or enum fields" as a key field. When we try that we get "java.lang.IllegalArgumentException: Composite key field is not a simple type or enum: Result$Key.recordId". Am I misreading the docs?
    Thanks,
    Trevor
    @Persistent
    public final class RecordKey {
    @KeyField(1)
    private final String name;
    @KeyField(2)
    private final int duplicateNumber;
    RecordKey(final String name, final int duplicateNumber) {
    this.name = name;
    this.duplicateNumber = duplicateNumber;
    RecordKey() {
    this.name = null;
    this.duplicateNumber = -1;
    @Persistent
    static final class Key {
    @KeyField(1)
    private final RecordKey recordId;
    @KeyField(2)
    private final String key;
    Key(final RecordKey recordId, final String key) {
    this.recordId = recordId;
    this.key = key;
    Key() {
    this.recordId = null;
    this.key = null;
    }

    Hi Trevor,
    You're nesting one key class inside another. All fields of a key class must be simple types or enums, which is what the exception message is trying to say. If you want all those fields in your key class, you'll have to include them in a single flattened class.
    Neither nesting of key classes nor inheritance of key classes is supported. We have enhancements filed to support these in the future, but no concrete plans.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Setting composite key in Container Managed Entity Bean

    In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.

    1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
    2. in your Bean declare keyA and keyB public.
    3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
    this is the method i use (with BAS) even if the key is simple (such as Integer).

  • How to defer the primary key validation to commit time

    Hi
    Is it possible to defer the primary key validation to commit time? I don't know why the framework checks for the unique key constraint immediately after inserting the row and before committing it. This causes "Too many objects match the primary key oracle.jbo.Key[null]" error if the user presses the create new record button multiple times before filling and saving the previous records.
    Thanks,
    Ferez

    Dear M.Jabr,
    Many thanks for your reply. I have access to the database but I prefer to use an ADF workaround to this problem rather than a DB workaround. I am not sure but I think that there should be a way to defer or disable primary key constraint in ADF.
    Anyway, I tried to make the primary key constraint DEFERRABLE in DB using PL/SQL developer but an error occurred (the name is used by another object) which I don't know why.
    Thanks,
    Ferez

  • Trouble with a composite key & unique violation

    Hi all
    as mentioned yesterday I'm a novice so apologies in advance for any lack of clarity in my question:
    I'm doing the standard student estate agent database and I have come across an issue with a composite key.
    the table in question follows:
    CREATE TABLE Offer
    buyer_id CHAR(5) not null references buyer (buyer_id),
    property_id CHAR(5) not null references property (property_id),
    primary key (BUYER_ID, PROPERTY_ID),
    offer_date DATE not null,
    offer_time NUMBER(4) not null,
    offer_amount NUMBER(10,2) not null
    and I have all the other tables in position with data loaded. However, when I try to load data into this table the buyer_id & property_id can be duplicated (it makes sense a buyer could make several offers on the same property).
    I'm not sure how to get around it. When I simply remove the primary key line the the next line offer_date.... is not recognized. I'm I missing something obvious? I am not allowed to changed the structure of the table. Do I need another identifier for the composite key?
    thanks Jo

    If you want to stick with natural primary keys, you would probably need to use the combination of (buyer_id, property_id, offer_date), assuming that the same buyer wouldn't make simultaneous offers on the same property. Given that this creates a rather unwieldy key for any child tables to reference, and given that the BUYER and PROPERTY tables appear to have synthetic foreign keys, you would probably want to add an OFFER_ID column to your table that is the primary key for the table and is populated via a sequence.
    Justin

  • Master-Detail query problem with composite key

    I have tested a MD form with EMP and DEPT tables and the MD query works okay.
    I have created two tables both with two fields EMP_ID and REPORT_DATE as a composite key. The problem I am having with the MD form is that it does not query back the results when I select the QUERY button. I have verified that the join is setup during the creation of the form.

    I have recreated the form and the MD query works fine.

  • (EJB-3) Can a many-to-one/one-to-may join field be part of a composite key?

    I've been setting up my first set of EJB-3 entites and I'm hitting an error I can't see the reason for. I don't have the code with me here- I'll add it to the thread tomorrow if there isn't a simple answer in the meantime.
    Two entity classes, Invoice and VatTotal. Invoice has a synthetic key, VatTotal is keyed on invoive id and vat code. VatTotals are children of the Invoice.
    So I code a Key class for the VatTotal entity, with Invoice and VatCode fields (VatCode is just a String). I define a ManyToOne property called invoice in VatCode and mark it @Id and a OneToMany field in Invoice called totals with type List<VatCode>
    Netbeans seems to accept it, but when I try and create the EntityManagerFactory (using Hibernate) it rejects the mappedBy=invoice on the OneToMany in Invoice.
    Does Hibernate accept ManyToOne properties as part of a composite key? Is there a problem using such a property in a OneToMany? Maybe I've done something dumb, but I can't see it.

    I don't think so. And I've seen some anomolies in the print preview (parts of messages getting cut off or munged up).

  • DATE Field in composite key

    Hi experts.
    I have a small query.
    Is there any performance impact of having a date field along with four other fields as part of a composite key.

    When you add an index, there is definitely some overhead to get the index synchronized with newly added/updated data (so whether you have indexed NUMBER, CHARs or DATEs does not matter - but I could be wrong in saying this).
    Concerning your SELECTs, if your existing queries were using this index then they may or may not use the new index (due to cardinality and other factors); so you need to test this first.

  • Primary Key in DW and indexes - composite key of all dimensional FKs?

    Hi guys,
    I have a DW and indexing question. Our metadata DW and physical DW are the same (star schema, no snowflakes). Should all dimensional FKs (such as TIME_KEY, ORG_KEY) be included as a part of a fact table's PK (a composite key becomes a combination of the TIME_KEY, ORG_KEY, etc.) in the database. Second question is, should we create just 1 composite index per fact table (resembling fact table's PK) or should we build several indexes (1 per dimension) ? Also, does it pay to build indexes on dimension tables?
    I'm mostly worried about fact table with a few hundred million records that has 7 dimensional-FK columns(only numeric codes), 1 value column, and several ETL-related date columns. I wonder what's the best course scenario be for that one.
    Thank you.

    You can use bitmap indexes on foreign keys to enable star transformations to be carried out. There are full details in the Datawarehouse documentation. Unfortunately I can't access it at the moment to show you where!
    As with anything you can check your performance using oracle trace events (10046) to ensure its performing as you want.
    http://www.dwoptimize.com/2007/06/101010-answer-to-life-universe-and.html
    Edited by: Matt T on Oct 22, 2008 4:50 PM

  • Composite key in Time dimension

    Hi All,
    I would like to know Time dimension with Composite key. I have a requirement where I want to store 2 Calendars in Time dimension table. for e.g :
    for one calendar Weekstarts from SUN-SAT and for another it is from MON-TUE
    DateKey   Type WeekStart   WeekEnd
    20140101   1       Sun               Sat      
    20140101   2       Mon               Tue
    ..................etc
    I have a measure group which is related to Time dimension (DateKey and Type used a Composite key). This implementation has no issues for additive measures but there are few issues with semi-additive measures (last non-empty,...).
    Will composite Key have any effect on semi-additive measures ?
    what if i use surrogate key instead of composite key.
    Please suggest if the approach has any issue with Time intelligence. Advise if there is any better approach for the same.
    Ram MSBI Developer

    Hey.. Thanks!
    I am clear about the concept about defining annotation based composite key. Also, I read in the documentation that I'll be needing to define as direct, aggregate or one-to-one. But, I am not able to define and run the same in the project mapping xml of toplink.
    It would be great if you can share some sample code for defining the same. For e.g. in my mentioned example, there is TestEntity POJO having 'id' as the attribute which gets populated with the testEntityCode of the TestEntityKey POJO. Please suggest the same for the same:
    <opm:primary-key>
    <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

  • Composite key constraint in SSIS

    Hi All,
    I have created one SSIS package to move data from one table to another table in same database using oledb connection.Now I want to enforce composite key constraint while moving data as follows:
    Table A has following contents :                                                 
    Col1   col2  col3
    1         a        b
    2         c        d
    3         a        b
    So,while moving data, i want to verify the contents of col2 and col3(col2+col3) ie,composite key made of col2 and col3.In this case i want to move data of row 2 only and data of row 1 and 3 will go to error log file.
    I am trying to use lookup here but no luck yet. Can anybody help me to achieve this .
    Thanks in advance,
    Sanket 

    Hi Sanket, 
    I do agree with Visakh approach if table reside on same server, why go for the SSIS. But If you still want to do it, here are steps(It bit complex for simple operation like this, i didn't find
    any other approach).  I am using same table structure as mentioned above: 
    create table sampletest
     col1 int ,
     col2 varchar(10),
     col3 varchar(10)
    GO
    insert into sampletest
    values (1,'a','b'),(2,'c','d'),(3,'a','b')
    1.)   Load the
    Data from source with all columns.
    2.)   Place an Aggregate
    Task .Here is configuration:
    Column
    Operation
    Col1
    Max/Min
    Col2
    Group by
    Col3
    Group by
     (*)  - Output Alias (say cnt)
    Count All
    Figure 1: 
    3.)  Place a condition split. With expression
    (DT_I4)Cnt == 1
    2.)   
    Move case1 to destination table and other conditional split to error table.
    Full Diagram:
    Regards Harsh

  • Is it possible to create foreign key from composite key in other table.

    SQL> desc PRODUCT_CONFIG_OPTION;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    SEQUENCE_NUM NUMBER(18)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> DESC PRODUCT_CONFIG_ITEM;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20)
    CONFIG_ITEM_TYPE_ID VARCHAR2(20)
    CONFIG_ITEM_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    LONG_DESCRIPTION CLOB
    IMAGE_URL VARCHAR2(255)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> desc product;
    Name Null? Type
    PRODUCT_ID NOT NULL VARCHAR2(20)
    PRODUCT_TYPE_ID VARCHAR2(20)
    PRIMARY_PRODUCT_CATEGORY_ID VARCHAR2(20)
    MANUFACTURER_PARTY_ID VARCHAR2(20)
    FACILITY_ID VARCHAR2(20)
    INTRODUCTION_DATE TIMESTAMP(6)
    SUPPORT_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISC_WHEN_NOT_AVAIL CHAR(1)
    INTERNAL_NAME VARCHAR2(255)
    BRAND_NAME VARCHAR2(100)
    COMMENTS VARCHAR2(255)
    =========
    CREATE TABLE PROD_CONFIG_PROD_CONFIG_OPTION (
    PRODUCT_ID VARCHAR2(20),
    CONFIG_ITEM_ID VARCHAR2(20),
    CONFIG_OPTION_ID VARCHAR2(20),
    PAGE_NUM_TO NUMBER(18),
    ALTERNATE_PAGE_NUM_TO1 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO2 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO3 NUMBER(18),
    LAST_UPDATED_STAMP TIMESTAMP(6),
    LAST_UPDATED_TX_STAMP TIMESTAMP(6),
    CREATED_STAMP TIMESTAMP(6),
    CREATED_TX_STAMP TIMESTAMP(6),
    CONSTRAINT PK_PROD_CAT_CONFIG_MOD PRIMARY KEY (PRODUCT_ID),
    CONSTRAINT FK_PRODUCT_ID FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT(PRODUCT_ID),
    CONSTRAINT FK_CONFIG_ITEM_ID FOREIGN KEY (CONFIG_ITEM_ID) REFERENCES PRODUCT_CONFIG_ITEM(CONFIG_ITEM_ID),
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_OPTION_ID) )
    TABLESPACE DATA_SMALL
    i try to create this table if i omit 3rd foreign key constraint then table successfully created.but including trd foreign key constraint it return error "ORA-02270: no matching unique or primary key for this column-list"
    i checked everything is it possible to create foreign key from composite key in other table.

    And
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_ITEM_ID,CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_ITEM_ID,CONFIG_OPTION_ID)
    ?

Maybe you are looking for

  • NOMAD Jukebox Zen Xtra 30gb dri

    Hiya, Sorry if its been asked before, but I installed a new Windows Vista 64bit about a month ago and since then I've searched all over the net trying to find a working driver that will allow me to transfer all of my music that I've collected over th

  • Changing property of select options

    Hi I have created a select options with the property read only = true by default, If a condition at the beginning is fulfilled I want to change the property read only of the previous field to false. I am doing it in the following way:     DATA lt_ran

  • How to create a loop in this case?

    Hi! I'm trying to use the if statement, but the code is only read once. How do I get this code to be read several times? For example, when the car passes the detector the number goes to 10. So the code does not detect the if statement because the cod

  • Photos in ps touch

    Why does PS touch show my screen shots of nexus7 from gallery but not the pics from other albums in the gallery?  My photos do not show up in PS touch. Thanks...sfopilot

  • IP Restrictions not taking effect until the Azure Website is manually restarted

    Hi, We are trying to limit IPs that connect to an Azure website using "system.webServer/security/ipSecurity". It appears that this restriction only works after the Azure website is manually restarted. Our web.config file looks like this: <system.webS