Violation of unique constraint in JPA in multiple threads

I get the following error message when you use APP to create a record in my database:
# < 14 October 2009 10:13:14 AM CDT > < Info > < EJB > < lharding pc > < AdminServer > < ExecuteThread [ASSET]: '3' for queue: '(self-adjusting) weblogic.kernel.Default' > < < anonymous > > < BEA1 003262EA920A3057A4BD > <>< 1255533194632 > < BEA-010227 > < EJB Exception occurred during invocation of home or business: weblogic.ejb.container.internal.StatelessEJBHomeImpl@589d49 threw the exception : javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse - 1.1.0.r3338 - M8 persistence Services): org.eclipse.persistence.exceptions.DatabaseException
Inner exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (BDSS. CONN_USER_DOMAIN_STATE_PK) violated

Error code: 1
Call: INSERT INTO USER_CONTEXT_STATES (ID, TEMP_FLG, STATE_INDEX, LAST_SYNC_TS, USER_CONTEXT_ID) VALUES (?,?,?,?,?)
link = > [12701, 100003, T, null, null]
Query: InsertObjectQuery (oracle.bdss.datamodel.UserContextStates@a4af11) >


I do the work of an EJB on Weblogic Server and I used the JDev "Entities of Tables" Wizard to generate the code for each table.

The code works fine most of the time. However when there are multiple threads using the EJB, I think that the allocation of the sequence becomes the same set IDS on different threads. The Session Cache for my persistence has the default "(soft low)".

Everyone seems it before and you know a solution?

The annotations that I use for the generation of PK for the ID column (where the unique constraint is violated) are:

@Id
@Column (nullable = false)
@TableGenerator (name = "UserContextStatesSeq", table = "SÉQUENCE",
scheme = "SDE", pkColumnName = "SEQ_NAME,"
valueColumnName = "SEQ_COUNT"
pkColumnValue = "BDSS. USER_CONTEXT_STATES «(, allocationSize = 50).
@GeneratedValue (strategy = GenerationType.TABLE,
generator = "UserContextStatesSeq")
Private Long id;


The code for the EJB is shown below (only the relevant parts):


@Stateless (name = "RuntimeEJBBean")
@Local
public class RuntimeEJBBean
implements RuntimeEJBLocal
{
@PersistenceContext (unitName = "persist")
Private EntityManager em;

public RuntimeEJBBean()
{
}

Private Sub createNewContextState()
throws the Exception
{
NewState UserContextStates = null;
Try
{
newState = new UserContextStates();
EM. Persist (newState);
...
EM. Flush();
catch (System.Exception e)
{
...
}
}

According to your annotation you use table named SEQUENCE to generate the id I suggest switching to sequence if you use Oracle.

So instead of

@TableGenerator (name = "UserContextStatesSeq", table = "SÉQUENCE",
scheme = "SDE", pkColumnName = "SEQ_NAME,"
valueColumnName = "SEQ_COUNT"
pkColumnValue = "BDSS. USER_CONTEXT_STATES «(, allocationSize = 50).
@GeneratedValue (strategy = GenerationType.TABLE,
generator = "UserContextStatesSeq")

use

@SequenceGenerator (name = "UserContextStatesSeq", sequenceName = "USER_CONTEXT_STATES_ID", allocationSize = 1)
@GeneratedValue (generator = "UserContextStatesSeq")

and db to create sequences:

CREATE THE SER_CONTEXT_STATES_ID MINVALUE SEQUENCE 1 WITH AN INCREMENT BY 1 1 COVER 50 ALL;

allocationSize = 1 in @SequenceGenerator with CACHE 50 in phrase makes any id generation caching done at Oracle no ORM.

If go to the sequence isn't an option, I would check if all error a bind ID with values such as XXXX01 or XXXX51. If Yes, then taking into account the fact that you have allocationSize = 50, it would mean that EclipseLink does not correctly synchronize award of the new id if that's the case then maybe change allocationSize 1 would help.

Tags: Fusion Middleware

Similar Questions

  • Need help with PK_REV_COL unique constraint violation

    We receive a SNPW. Violation of unique constraint of PK_REV_COL when you try to reverse a pipe delimited source file. There is no column twice in the source file name, but the same column names are used in several different input files. Does anyone have a solution to this problem?

    Hello

    Tryied to reproduce such behaviour on my side, I'm was not possible for me.

    The only one that occurs to me is, drop the current data store and recreate on...

    Cezar Santos
    [www.odiexperts.com]

  • Unique constraint violation error

    Hi all

    I have a procedure called - FHM_DASHBOARD_PROC which inserts data into a table called FHM_DASHBOARD_F retrieve records in multiple tables. However, for a particular type of record, these data are not inserted because of the Unique constraint violation

    the procedure is:
    create or replace
    PROCEDURE FHM_DASHBOARD_PROC AS
    
    DB_METRICS_CNT1Z number;
    --V_PODNAME varchar2(10);
    V_KI_CODE_DB_STATSZ varchar2(50);
    V_ERRORSTRING varchar2(100);
    
    --CURSOR PODNAME_CUR IS SELECT PODNAME,SHORTNAME FROM CRMODDEV.POD_DATA WHERE PODSTATUS_ID=1 AND PODTYPE_ID=1 ORDER BY PODNAME;
    
    
    -- DB STATS
    
    BEGIN 
    
      -- OPEN PODNAME_CUR;
        --   LOOP
          --   FETCH PODNAME_CUR INTO V_PODNAME,V_POD_SHORTNAME ;
            -- EXIT WHEN PODNAME_CUR%NOTFOUND;
    
               BEGIN
               
                     SELECT COUNT(*) INTO DB_METRICS_CNT1Z FROM FHM_DB_METRICS_F A, FHM_DB_D B where A.DBNAME=B.DBNAME and PODNAME=V_PODNAME AND DB_DATE=TRUNC(SYSDATE-1);
                               DBMS_OUTPUT.PUT_LINE('DB_METRICS_CNT1Z :'|| DB_METRICS_CNT1Z);
                               IF DB_METRICS_CNT1Z >0 THEN
                             
                        DBMS_OUTPUT.PUT_LINE('DB STATS');
                                  
                       INSERT INTO FHM_DASHBOARD_F(PODNAME,DASH_DATE,KI_CODE,KI_VALUE,KI_STATUS)
                                  
                          (SELECT PODNAME, DASH_DATE AS CU_DATE, KI.KI_CODE, NVL(PF.KI_VALUE,0), 
                                                                  CASE
                                                                   WHEN PF.KI_VALUE = ki.warning_threshold then 2
                        when PF.KI_VALUE=0 then 0
                        ELSE 1 
                        END  AS ALERT_STATUS
                        
                        FROM 
                        
                        (SELECT PODNAME,DB_DATE AS DASH_DATE,decode(a.stats_last_status,'SUCCEEDED',1,'FAILED',2,'STOPPED',2,NULL,0) KI_VALUE from  
                        FHM_DB_METRICS_F a,fhm_db_d b where a.dbname=b.dbname and podname='XYZ' and db_date=TRUNC(SYSDATE-1) and dbtype='OLTP')PF,
                        FHM_KEY_INDICATOR_D KI where PF.PODNAME=KI.POD_NAME AND KI.TIER_CODE=3 AND KI.KI_NAME='DB_STATS'
                        AND (PF.PODNAME,TRUNC(PF.DASH_DATE),KI.KI_CODE) NOT IN (SELECT PODNAME,DASH_DATE,KI_CODE FROM FHM_DASHBOARD_F)); 
                                 COMMIT;
                     
                             ELSE
                                    SELECT KI_CODE INTO V_KI_CODE_DB_STATSZ FROM FHM_KEY_INDICATOR_D WHERE POD_NAME=V_PODNAME AND KI_NAME='DB_STATS';
                                     DBMS_OUTPUT.PUT_LINE('V_KI_CODE_DB_STATSZ :'||V_KI_CODE_DB_STATSZ);
                                     INSERT INTO FHM_DASHBOARD_F(PODNAME,DASH_DATE,KI_CODE,KI_VALUE,KI_STATUS) VALUES(V_PODNAME,TRUNC(SYSDATE-1),V_KI_CODE_DB_STATSZ,0,0); 
                                     COMMIT; 
                                     
                             END IF;
                            
         EXCEPTION
                            WHEN OTHERS THEN
                            V_ERRORSTRING :='INSERT INTO FHM_DASHBOARD_F_ERROR_LOG(POD_NAME,KI_NAME,ERRORNO,ERRORMESSAGE,DATETIME) VALUES
                   ('''||V_PODNAME||''',''DB_STATS'','''||SQLCODE||''','''||SQLERRM||''',SYSDATE)';                         
                   EXECUTE IMMEDIATE  V_ERRORSTRING;
                            COMMIT;
              END;
    
          --END LOOP;
      --CLOSE PODNAME_CUR;
    
    
    END;
    
    
    END FHM_DASHBOARD_PROC;
    and the table where data integration is
    CREATE TABLE "CRMODDEV"."FHM_DASHBOARD_F"
      (
        "PODNAME" VARCHAR2(25 BYTE) NOT NULL ENABLE,
        "DASH_DATE" DATE,
        "KI_CODE"   NUMBER NOT NULL ENABLE,
        "KI_VALUE"  NUMBER,
        "KI_STATUS" NUMBER,
        CONSTRAINT "FHM_DASHBOARD_F_DATE_PK" PRIMARY KEY ("DASH_DATE", "PODNAME", "KI_CODE") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CRMODDEV_IDX" ENABLE,
        CONSTRAINT "FHM_DASHBOARD_F_KI_CODE_FK" FOREIGN KEY ("KI_CODE") REFERENCES "CRMODDEV"."FHM_KEY_INDICATOR_D" ("KI_CODE") ENABLE
      )
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING STORAGE
      (
        INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
      )
      TABLESPACE "CRMODDEV_TBL" ENABLE ROW MOVEMENT ;
    the constraint primary key is FHM_DASHBOARD_F_DATE_PK and is on 3 columns of the table, DASH_DATE, PODNAME, KI_CODE



    And it's the query used in the procedure to insert the data into the table
    (SELECT  PODNAME, DASH_DATE AS CU_DATE, KI.KI_CODE, NVL(PF.KI_VALUE,0), 
                                   CASE
                                   WHEN PF.KI_VALUE = ki.warning_threshold then 2
    when PF.KI_VALUE=0 then 0
    ELSE 1 
    END  AS ALERT_STATUS
    From 
    (Select  Podname,Db_Date As Dash_Date,Decode(A.Stats_Last_Status,'SUCCEEDED',1,'FAILED',2,'STOPPED',2,Null,0) Ki_Value From  -- Added Distinct
    FHM_DB_METRICS_F a,fhm_db_d b where a.dbname=b.dbname and podname in ('XYZ') and db_date = TRUNC(SYSDATE-2) and dbtype='OLTP')PF,
    Fhm_Key_Indicator_D Ki Where Pf.Podname=Ki.Pod_Name And Ki.Tier_Code=3 And Ki.Ki_Name='DB_STATS'
    And (Pf.Podname,Trunc(Pf.Dash_Date),Ki.Ki_Code) Not In (Select Podname,Dash_Date,Ki_Code From Fhm_Dashboard_F));
    It gives * record * 2 suite
    ---------------------------------------
    XYZ JANUARY 20 12 2521 1 1
    XYZ JANUARY 20 12 2521 1 1

    It gives the Unique constraint violation error when inserting. Then, I changed in the above insertion code by adding a distinct clause. Once the query gives only a SINGLE record accordingly. However, this record is not be inserted into the table and give the same error.

    Now the question is how should I insert that record into the table with success?


    If the message is too long, however, I gave you the real structure of the object or procedure and error.

    Thank you in advance.

    When you have 5 columns in the game adding THAT SEPARATE is n ot solution that you can still get the same error once.

    Check the target table if the data exists before inserting... If this is not the case, check the structure of the table for a unique constraint created on other columns.

    select *from 
    where
    DASH_DATE=date '2012-01-20'
    and PODNAME='XYZ'
    and  KI_CODE=2521;
    
  • Unique constraint violation

    I just got an error of constraint unique violation when I tried to insert a row in a table.
    But even after that I deleted the PK constraint on the table in question, I still get the same error message when I try again the insert:
    SQL error: ORA-00001: unique constraint (GILLNET_TAG. DELETED_AUTH_PK) violated
    00001 00000 - "forced single (s.%s) violated."
    * Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you can see
    This message if there is an entry double at a different level.
    * Action: Either remove the single restriction or not to insert the key.

    Can someone tell me why? The removal of the constraint simply not registered with SQL Developer?
    Thank you.

    Because you have only removed the constraint, not the corresponding unique index.

    But... Why are you doing it? The unique constraint is there for a reason.

  • correct handling of foreign keys in unique constraints for operations ON DELETE SET NULL

    During my troubleshooting at a client site, I came across an interesting setup where I would like to ask your opinion.


    Consider two tables ADTB and TBLB.

    ADTB:

    INT COLA1

    COLA2 INT

    TBLB:

    COLB1 INT

    COLA2 is COLB1 as a foreign key ON DELETE SET NULL value.

    COLA1 and COLA2 are combined into a UNIQUE for the BATTERY constraint.

    I have two records of TBLB:

    (1)

    (2)

    and two DRUM recordings:

    (1, 1)

    (2, 2)

    so far, all the constraints are valid.

    During my research, I learned that I can not put COLA2 null in ADTB for two lines at the same time:

    TBLA UPDATE set COLA2 = NULL where COLA1 = 1;

    -> OK

    TBLA UPDATE set COLA2 = NULL where COLA1 = 2;

    -> VIOLATED UNIQUE CONSTRAINT

    Unfortunately, it's something my application needs, anyway. In order to get this resolved, but I try to understand, what would happen if I:

    REMOVE THE TBLB;

    ?

    It should set COLA2 in ADTB "Null" on the two lines, which is not allowed due to the UNIQUE CONSTRAINT.

    Can someone shed light on this issue? Thank you.


    Yours,

    Ronny

    Unfortunately, as you say, you can't not NULL values in such a unique constraint.  It would be the same as if you had a composite primary key and try to allow one of the columns will be null in several rows with the same value in the other column.  NULL is treated as an "unknown" value, it is possible that it could be the same value (it may or may not be, but Oracle does not know), so it must assume that it might be and that's why treat it as if there is the potential for a duplicate... so it's not unique.

    In short, do not allow null values in your unique constraints.

    The default is in the drawing, not in the way that Oracle is the treatment.  Fix the design if you do not have NULL values.

    In terms of relational database design, it seems that you are trying to transform the 1:M relations M:M relations, and which requires an intermediate table if you have M:1 and 1:M between 3 tables instead.

  • Unique constraint in the form of master detail error

    Hi all

    I need help, the following requirement.

    I have a master detail form developed on master-child table. the tables have the composite key.

    Old masters has a composite key on columns (A, B)

    Children table has a composite key on columns (A, B, C)

    Child block look something like below

    C       A          B

    10 AAA 1000

    20 1300 BBB

    30 CCC 1400

    40 DDD 1200

    Increments of column C with 10 for each record, and if a new record is insert in intermediaries the records it is incremented to 5.

    My requirement is when an end user attempts to insert record between 20 and 30 or 30 and 40 and clicks on save, the value of the C column must regenerate as shown below

    C       A          B

    10 AAA 1000

    20 1300 BBB

    XXX 30 900

    40 CCC 1400

    50 DDD 1200

    Button Save I wrote the following code

    Declare
      ln_Count NUMBER :=0;
      ln_c number :=0
      cursor c1 is
      select c
      from child
      where a=:child.a
      and b=:child.b
    Begin
      Go_Block('Child');
      First_Record;
      LOOP
      ln_Count:= ln_Count+10;
      :child.C := ln_Count;
      EXIT When :System.Last_Record = 'TRUE';
      Next_Record;
      END LOOP;
    
    
      For c_cur in c1 Loop
      update child
      set c:=ln_c+10
      where a=:child.a
      and b=:child.b 
      and c=c_cur.c
      end loop;
      Forms_DDL('commit');
         
         commit_prc('Commit');  -- We have our own program unit to call commit_form
    
    END;
    

    I tried above in a way because, before approving the changes to the table, I update the existing values in the table of the C column so I would not get unique constraint error.

    When you click the button Save, I get a constraint exception. Hope I made my requirement clear.

    Can someone give me a clue to this implementation.

    Thank you

    malandain

    With this update, all your C-columnvalue became negative. When you post the form thereafter, forms update agaion records one by one the new positive figures. Because the numbers of 'old' in the db are now negative, there will be no violation-UK.

  • How to display a validation on a modal dialog error based on a unique constraint?

    Hi all

    Apex 4.1

    See example on apex.oracle.com:

    Workspace: EDIAZJORGE

    User name: TEST

    Password: test123

    Application: 55036 - Validation of modal Page

    I have a page with two elements, to make and model, where the user will be able to enter the model, say, a car and use a pick to dolist. If make does not exist, the user can click on the [+] button that opens a modal dialog box to add a new do.

    Everything works fine except when I try to insert a double do, which triggers a unique constraint violation error:

    AJAX call back Server error ORA-00001: unique constraint (EDIAZJORGE. MAKE_UK1) violated to execute the PL/SQL Code

    I want to enter this event and inform the user about an error inside the modal dialog box, but I don't know what is the best way to achieve this. My guess is that I'll have to make an Ajax call to run an application process and capture the exception of DUP_VAL_ON_INDEX, but I'm not very familiar with the Ajax part.

    Any suggestions?

    Thank you

    Erick

    I'm sorry Erick, I was in error. You always get an alert but with a nicer message. The actions of builtin DA do not allow interaction with them, so no way to manage the return of ourselves.

    In light of this, I copied the page in enforcement 77635 1-2 and made some changes to it. Basically, I copied the code to Jorge and modified so that it uses $.ajax instead of apex.server.process. I much prefer it to htmldb_Get - you shouldn't really use it either. More $.ajax has the advantage of this apex.server.process is based on it. That should work well on 4.1.

    Sorry Jorge, won't steal the Thunder, I guess I was... bored? And decided to do some apex?

  • Oracle DB: Check Unique constraints before award of sequence (ID)

    Hello!

    I am building a Java web application using JPA.

    I used to fill the table IDs, sequences of generators, reported through DB and javax.persistence annotation (@Sequence).

    Some tables have simple unique constraints (example: Table_Country: Country column "country_name" must be Unique).

    At the time of execution, trying to persist a country name that is already in my Table_Country, java will throw exception: OK. But I noticed: before that, DB has allocated a sequence ID to my object.

    My question is: there's way (apart from making programmatic or triggers for and during the audit) of database to check unique constraints before award of sequence?

    Thanks in advance!

    My question is: there's way (apart from making programmatic or triggers for and during the audit) of database to check unique constraints before award of sequence?

    No - for several reasons.

    1. the real constraint is not verified by Oracle until you provide the values you are using Oracle.

    2. If you try to perform the audit before giving the value to Oracle another user could enter this value and insert it before you and which would still cause your problem.

    Oracle is a multi-user system. Even if you try to "look" at the next value in the sequence other users could easily allocate this value until you can get it so the value you 'read' would really not be the value you get.

    You can't tell what the value of the next sequence will be except by actually calling NEXTVAL to return.

    As others have said it seems that yours is a JPA number.

  • Question of the unique constraint with finance charge

    Hi friends,

    As part of the implementation of 11 g BIAPPS-ODI during the execution of a finance charge is my load of CM plan failed with the error like below

    ODI-1519: series step 'Load start Plan (InternalID:1242500)' failed because step 'Refresh Global Variable (InternalID:1243500)' child is in error.

    ODI-1519: series step 'Refresh Global Variable (InternalID:1243500)' failed because the step child "Warehouse loading Phase (InternalID:2336500)" is a mistake.

    ODI-1519: series step "Warehouse loading Phase (InternalID:2336500)" failed because the child step "SIL 1 charge (InternalID:2337500)" is a mistake.

    ODI-1519: series step '1 SIL Load (InternalID:2337500)' failed, because the child step '2 group of dimensions of SIL (InternalID:2338500)' is a mistake.

    ODI-1519: series step '2 group of dimensions of SIL (InternalID:2338500)' failed because the child step "Parallels - independent DimGroup (InternalID:2346500)" is a mistake.

    ODI-1518: parallel step 'Parallels - independent DimGroup (InternalID:2346500)' failed. level of 1 child by mistake, which is more than the maximum number of allowed errors (0) defined for parallel step.  Has no measures of the child: 3 SIL Dims POSHIER_DIM (InternalID:2369500)

    ODI-1519: series step '3 SIL Dims POSHIER_DIM (InternalID:2369500)' failed because the child "POSHIER_DIM (InternalID:2372500)" is a mistake.

    ODI-1519: series step "POSHIER_DIM (InternalID:2372500)" failed because step "SIL_PositionDimensionHierarchy (InternalID:2377500)" child is in error.

    ODI-1217: SILOS_SIL_POSITIONDIMENSIONHIERARCHY Session (4278500) fails with return code 1.

    ODI-1226: SIL_PositionDimensionHierarchy.W_POSITION_DH step fails after 1 attempt.

    ODI-1240: Flow Run SIL_PositionDimensionHierarchy.W_POSITION_DH fails during an operation of integration. This flow of charge table target W_POSITION_DH.

    ODI-1228: SIL_PositionDimensionHierarchy.W_POSITION_DH (integration) of the task fails when connecting ORACLE target BIAPPS_DW.

    Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEV_DW. W_POSITION_DH_U2) violated

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)

    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)

    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)

    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)

    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)

    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1115)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)

    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3954)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1539)

    at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)

    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)

    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)

    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:577)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1895)

    to oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$ 2.doAction(StartScenRequestProcessor.java:580)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.doProcessStartScenTask(StartScenRequestProcessor.java:512)

    to oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$ StartScenTask.doExecute (StartScenRequestProcessor.java:1068)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:137)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)

    at java.lang.Thread.run(Thread.java:662)

    How to solve the question above using ODI 11 g. I'm using Oracle ERP R12.1.3 as a source of data for this.

    Thanks in advance.

    Kind regards

    Saro

    What is the result of a query on table W_POSITION_DH or W_POSITION_D duplicate?

    Naeem

  • Retrieve values with a unique constraint

    All,

    It may be a stupid request and I think too speak of it. But, for some reason, I am unable to write a query to accomplish my task.

    I have the T table with some columns and the columns c1, c2, c3 are part of a composite unique constraint. Now I'm updating the value c3 from 52 to 51. But, when I do an update like:

    Update T set c3 = 51 where c3 = 52;

    I get a Unique constraint violation error.

    So, I need to know what are the values of repetition that might be causing this?

    Thanks in advance guys.

    34a22dde-3108-4F05-BE72-eb1043d28314 wrote:

    All,

    It may be a stupid request and I think too speak of it. But, for some reason, I am unable to write a query to accomplish my task.

    I have the T table with some columns and the columns c1, c2, c3 are part of a composite unique constraint. Now I'm updating the value c3 from 52 to 51. But, when I do an update like:

    Update T set c3 = 51 where c3 = 52;

    I get a Unique constraint violation error.

    So, I need to know what are the values of repetition that might be causing this?

    Thanks in advance guys.

    An inelegant way...

    select *
    from your_table tab1
    where (tab1.c1,tab1.c2) in
    (
    select tab2.c1, tab2.c2
    from your_table tab2
    where tab2.c3 = 52
    )
    where tab1.c3 = 51;
    
  • ORA-00001: unique constraint

    Hi all

    I use ODI 11.6 and Oracle 11 g.

    When executing my interface, I get the error inserting new line below rate

    ODI-1228: failed INT_TEMP_TO_MOSA (integration) task on the target of ORACLE EDGE_DEV_OWNER connection.
    Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (EDGE_DEV_OWNER. SP_MOS_PK) violated

    Any ideas how to solve this problem?

    Thank you
    Lony

    Check the separate option in the stream tab. Do not drop the I$ table. Run a group of query keycolumn in Toad cons I$ table and see whether or not duplicate records exist.
    Thank you.

  • Get the "unique constraint" error while mapping custom jsp

    Hello

    We are implementing iStore R12 (12.1.3).

    We have customized ibeCCtdMenu.jsp, renamed as xxibeCCtdMenu.jsp and moved to $OA_HTML / folder.

    Now in the template Manager, we create a new source (xxibeCCtdMenu.jsp) file to the title of "model of generation of Menu".

    However when we select site and language like 'All', it gives following error:
    Error in the logical record of physical mapping
    ORA-00001: unique constraint (IBE. IBE_DSP_LGL_PHYS_MAP_U2) violated in the package IBE_PhysicalMap_GRP procedure save_physicalmap
    All the sites and all the language already exists exists for 7670 deliverable

    How can we overcome them this error? Please notify.
    Thank you
    Vivek

    for a given Site and the language combination, can exist only one model.
    Default file provided by Oracle is set with combination like all Sites - all languages, and you will not be able to change it.

    Save your file with combination such as all Sites - English
    or , all languages.

    Then it will work fine.

    Hrishikesh

  • ORA-00001: unique constraint (GML. PO_ORDR_DTL_U1)

    Hello

    I have this error after I start the synchronization of joint purchase OPM. Help, please.


    Thank you very much

    Kind regards
    peopsquik
    $ oerr ora 00001
    00001, 00000, "unique constraint (%s.%s) violated"
    // *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
    //         For Trusted Oracle configured in DBMS MAC mode, you may see
    //         this message if a duplicate entry exists at a different level.
    // *Action: Either remove the unique restriction or do not insert the key.
    $
    
  • composite unique constraint on the values of parent and child?

    Is it possible to have a composite unique constraint that contains the values of the child elements? The example below has the "child" elements are offline, but it's preferred, but optional, I know that you can have a unique constraint in the set of tables without using a reference table that contains the constraint and the two columns. How xdb manages this requirement?

    permit:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    <parent ID="2">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    not allowed:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test1</name></child>
    </parent>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
               xmlns:xdb="http://xmlns.oracle.com/xdb"
               xdb:storeVarrayAsTable="true"
               elementFormDefault="qualified">
        
        <xs:element name="parent" type="Parent_T"
            xdb:columnProps="CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID)"
            xdb:defaultTable="PARENT"/>
    
        <xs:complexType name="Parent_T" xdb:SQLType="PARENT_T" xdb:maintainDOM="false">
            <xs:sequence>
                <xs:element name="child" type="Child_T" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="CHILD"
                          xdb:SQLInline="false" xdb:defaultTable="CHILD" "/>
            </xs:sequence>
            <xs:attribute name="ID" xdb:SQLName="ID" use="required" />
        </xs:complexType>
        
        <xs:complexType name="Child_T" xdb:SQLType="CHILD_T">
           <xs:sequence>
             <xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
           </xs:sequence>
         </xs:complexType>     
    </xs:schema>
    xdb:columnProps = "CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID), * UNIQUE (XMLDATA.» "Child.Name) *" triggers the non-existent attribute


    A possible solution would be to copy the value of the primary key parent of the child element, then I could create a composite unique constraint using only the values of the child. However, I have this same requirement elsewhere in my lowest nested schema, and it can become messy / bad design with cascading of all primary keys on the schema. For example, I have a recursive element in which two attributes must be unique only within the parent company:
    <parent id="1">
       <child a="1" b="1">
          <child a="1" b="2">
             <child a="1" b="1" /> *not allowed
          </child>
       </child>
       <child a="1" b="2" /> *not allowed
    </parent>
    Possible solution:
    <child a="1" b="2" parent_id="1" />
    <xs:complexType name="Child_T>
       <xs:sequence>
          <xs:element name="child" xsd:SQLInline="false" xsd:columnProps="UNIQUE(XMLDATA.a,XMLDATA.b,XMLDATA.parent_id)" minOccurs="0" maxOccurs="unbounded" type="Child_T">
       </xs:sequence>
       </xs:element
    </xs:complexType>
    Is there a better design?

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi 
    PL/SQL Release 10.2.0.4.0 - Production                           
    CORE     10.2.0.4.0     Production                                       
    TNS for Linux: Version 10.2.0.4.0 - Production                   
    NLSRTL Version 10.2.0.4.0 - Production 

    You can do something like this:

    SQL> DECLARE
      2
      3    xsd_doc xmltype := xmltype('
      4  
      5    
      6      
      7        
      8          
      9        
     10      
     11    
     12    
     13      
     14        
     15          
     16        
     17      
     18    
     19    
     20      
     21        
     22          
     23        
     24        
     25      
     26    
     27    
     28      
     29        
     30          
     31        
     32      
     33    
     34  ');
     35
     36  BEGIN
     37
     38    dbms_xmlschema.registerSchema(
     39      schemaURL => 'test_parent.xsd',
     40      schemaDoc => xsd_doc,
     41      local => true,
     42      genTypes => true,
     43      genbean => false,
     44      genTables => false,
     45      enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
     46    );
     47
     48  END;
     49  /
    
    PL/SQL procedure successfully completed
    
    SQL> CREATE TABLE my_xml_table OF XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "test_parent.xsd"
      4  ELEMENT "root"
      5  VARRAY xmldata."parent" STORE AS TABLE my_parent_tab
      6  (
      7    VARRAY "child" STORE AS TABLE my_child_tab
      8  )
      9  ;
    
    Table created
    
    SQL> ALTER TABLE my_parent_tab ADD CONSTRAINT parent_uk UNIQUE (nested_table_id, "ID");
    
    Table altered
    
    SQL> ALTER TABLE my_child_tab ADD CONSTRAINT child_uk UNIQUE (nested_table_id, "name");
    
    Table altered
     
    

    Then:

    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.PARENT_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test1
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.CHILD_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    
    1 ligne créée.
    

    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14259/xdb06stt.htm#sthref987

  • Unique constraint shot while refreshing in the MERGE statement.

    Hi guys

    I have a question that I can't solve. Would appreciate any help on this. The configuration of the data and the script is as below.
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 4 11:46:02 2011
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> 
    
    create table table_1
    (id number,
     id_name varchar2(20));
     
    Alter table table_1 add primary key(id);
    
    create table table_2
    (id number,
     id_name varchar2(20));
     
     insert into table_2 values (1, 'id_1');
     insert into table_2 values (2, 'id_2');
     insert into table_2 values (1, 'id_1_upd');
    
    SQL> select * from table_1;
    
    no rows selected
    
    SQL> select * from table_2;
    
            ID ID_NAME
    ---------- --------------------
             1 id_1
             2 id_2
             1 id_1_upd
    
    SQL> 
    
    SQL>  merge into table_1 target
      2   using (select id, 
      3                 id_name
      4            from table_2) source
      5   on (source.id = target.id)
      6   when matched then
      7      update set target.id_name = source.id_name
      8   when not matched then
      9      insert(id,
     10             id_name)
     11      values(source.id,
     12             source.id_name);
     merge into table_1 target
    *
    ERROR at line 1:
    ORA-00001: unique constraint (SYS_C00137508) violated
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  select constraint_type, table_name, status
      2*   from user_constraints where constraint_name = 'SYS_C00137508'
    SQL> /
    
    C TABLE_NAME                     STATUS
    - ------------------------------ --------
    P TABLE_1                        ENABLED
    Can someone help me please to solve this as the actual code that I am developing has the same configuration and I am constantly getting this error. As long as the same record does not come to the top in the 'source' table, MERGE performs an update or an insert.
    But as a "duplicate" coming soon to update, I get the error of unique constraint.

    Thank you
    -K.B.

    Dear Sir

    ERROR at line 1:
    ORA-00001: unique constraint (SYS_C00137508) violated
    

    You think two things

    (a) coherent reading: what was the situation of table_1 when the maching clause was initially assessed. There were 0 insert rows that correspond to which means that the merge operation will be all
    (b) your corresponding clause has a problem: the join column must be unique in both tables the case the merger will be ambiguous. You do not have a unique key on the source table
    (c) think that the merge operation will never insert id = 1 and then update id = 1 within the same operation. Will never happen

    Hope this helps

    Mohamed Houri

Maybe you are looking for