Primary Key problem in 11g - Known issue 6894412

Hi Everyone:
We are on JDeveloper 11.1.1.4, and JHeadstart 11.1.1.2.46. This thread originally started on the JHeadstart forum and can be seen at: Problem with LOV's in 11g
We are converting our 10g application to 11g. We have an established Oracle database that does not use pre-populated primary keys that are sequence number. Our database has composite keys and the integrity of those composite keys are established by foreign key constraints to edit tables. This approach has worked extremely well for us for over a decade, the logic of the database has been designed so that the database protects itself through the elimination of cascade deletes where necessary, and cascade deletes as the business logic dictates. This will not be changing.
In the database tables in which the 10g application has been displayed in the table format, after conversion to 11g, the LOV pop-ups are not working unless the SAVE button (or refresh of the browser) has been pressed. The first LOV pop-up will work, but as soon as you select a value from it, the next LOV pop-ups will not execute until the SAVE or REFRESH is done. This is only in table format. If the display format is form, our primary key LOV's work fine. In 10g, this functionality worked fine as long as we didn't use an "ADD ROW" button on a table format. The Add Row button caused the primary key values to be returned to the application, but not be displayed on the screen. A refresh would then show them.
From the initial investigation in the JHeadstart forum, I realize that we are hitting the "Primary Keys from Model" 6894412 problem that is listed in the 11.1.1.4 Release Notes. We have spent many, many hours establishing a re-usable .jar file of all of the entities of this very large database as suggested by JDeveloper Best Practises (http://download.oracle.com/docs/cd/B31017_01/web.1013/b25947/bcadvgen007.htm). This has worked very well for us in 10g - define all the entity specifics in one place, once, then every application can re-use them. Productivity at its finest. Therefore, we cannot make fake columns in our database in order to fix this "limitation" in 11g. We have many complex parent/child/child tables to put into our application which will not work unless our entities have the primary keys properly defined. I have tried to implement the workaround that was found in the release notes, but have been unable to get it to work.
I have created a testcase with the HRSchema by adding a table to that Schema that I can provide the SQL commands for, but I do not know who in Oracle support to send it to. Could someone please provide me with the information on who to contact. I have, I believe, taken all the steps as established in the release notes for this problem and have clearly documented the changes in the .jsff page, but the problem still exists. Clearly, I am doing something wrong, or need more information.
Thank you in advance
Mary
UofW

Frank:
I thank you for your reply.
I have been working on the JHeadstart forums for so long, I actually forgot how to submit things to Metalink, and now that I have done it again...SR #3-3101357281 for this issue....I realize why I blocked out using Metalink from my memory.
It took me an incredible amount of time to fill that SR in, then after completing everything, I was sent a request by the person assigned to the SR to repeat the instructions of how to run my testcase. I had already filled out all of the instructions on how to run the testcase in the "Notes to Oracle" section of the upload step. Almost every time I send something to Metalink, I have to repeat things. It seems as though they aren't read fully and any reason at all is used to send them back to the client.
My dealings with Metalink have been very, very frustrating. My colleagues share this sentiment.
Mary
UofW

Similar Messages

  • Replication for Data on DEV and QA - bad idea - primary key problem now

    I goofed.  I tried to use replication to keep the data on my dev machine up to date with the live server.  Now when I try to work on the database, adding new stuff, it fails.  It says there is a primary key problem every time I try to add
    a new item to a table with my program.  I should have realized this would happen!  Now, even though I've removed the replication, I'm having the problem.  Can anyone help me get my database functional again :/  Or should I resort to a database
    restore.  Thanks!

    So you have an IDENTITY column in your table? Run a
    DBCC CHECKIDENT (Transact-SQL) command with option RESEED to fix the current identity value to see if it works then.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Mapping ejb and database - primary key problem

    I'm trying to map some ejb's to an existing database. Unfortunately, when I load the db schema into deploytool, the table I'm interested in is not available because it doesn't have any primary key defined.
    Is it impossible to map an ejb to a db table without primary key ?
    Is it a sun-specific feature, or can I expect the same behaviour from other application servers vendors ?
    Thanks for the help.

    Hi Maxime,
    In J2EE RI 1.4, you can't map beans to tables w/o primary keys. I don't know, how other other products treat this issue.
    Regards,
    -- markus.

  • CMP with Auto-increment Primary Key problem

    I'm trying to set a column as IDENTITY in PointBase and have the app server utilize this in the CMP beans. I followed the instructions from the tutorial:
    - In the deployment descriptor, the primary key class is defined as a java.lang.Object. The primary key field is not specified.
    - In the home interface, the argument of the findByPrimaryKey method must be java.lang.Object.
    - In the entity bean class, the return type of the ejbCreate method must be a java.lang.Object.
    Below is (a fragment of) my deployment descriptor:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <display-name>CMPModule</display-name>
    <enterprise-beans>
    <entity>
    <display-name>DocState</display-name>
    <ejb-name>DocState</ejb-name>
    <home>com.sun.itstar.j2ee.projectdocmgt.ejb.DocStateHome</home>
    <remote>com.sun.itstar.j2ee.projectdocmgt.ejb.DocState</remote>
    <local-home>com.sun.itstar.j2ee.projectdocmgt.ejb.LocalDocStateHome</local-home>
    <local>com.sun.itstar.j2ee.projectdocmgt.ejb.LocalDocState</local>
    <ejb-class>com.sun.itstar.j2ee.projectdocmgt.ejb.DocStateBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Object</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>DocState</abstract-schema-name>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>color</field-name>
    </cmp-field>
    </entity>
    In the admin-serv/logs directory I get the follow message (bad place for the logs, took me a while to find where it was putting it!):
    [24/Sep/2002:16:33:57] WARNING ( 4165): Validation error in bean DocumentType: Warning: All primary key columns in primary table DOCUMENT_TYPE of the bean corresponding to the generated class com.sun.itstar.j2ee.projectdocmgt.ejb.DocumentTypeBean_387898907_JDOState must be mapped to key fields.
    Map the following primary key columns to key fields: DOCUMENT_TYPE.ID. If you already have fields mapped to these columns, verify that they are key fields.

    Great! This worked. Here are some clear steps:
    1. delete the field from the CMP
    2. delete any business methods that you might have for the field
    3. go to the properties of the bean, find the primary key property. Set the property to Unkown Primey Key Class (java.lang.Object)
    Now there is a bigger problem. CMR fields. In ejbPostCreate() the bean gets its own pk and looks up other related beans. Now that I have removed the accessor to the pk field (and the pk field from the bean), how do I lookup the relationships?
    I need some method that I can call from within ejbPostCreate() that will return the primary key...
    I tried adding the field back in but not as the primary key. That generated an exception that said you cannot do that. If the field is the pk it must be marked as the pk.
    Any ideas?

  • Primary key problem - Urgent! PLEASE, HELP!

    Hi all,
    I'm new here, and I have a stupid problem, I think. If someone could help me, I'll be grateful.
    I have to build a very simple JSP application using a few database tables, providing the base functionality: insert, update, delete, search.
    I'm using Oracle 8.1.7, and JDeveloper 9.0.3
    One table looks like that:
    CREATE TABLE TEST (
         sPrimaryKey varchar2(30) not null,
         sField varchar2(100)
    ALTER TABLE TEST
    ADD ( CONSTRAINT test_id_pk
              PRIMARY KEY (sPrimaryKey)
    I'm using a sequence for generating primary key...
    CREATE SEQUENCE test_seq
    START WITH 100
    INCREMENT BY 1
    NOCACHE
    NOCYCLE;
    ... and a trigger before insert for seting the new value of the primary key.
    CREATE OR REPLACE TRIGGER BI_TEST
    BEFORE INSERT ON TEST
    FOR EACH ROW
    DECLARE
         new_id integer;
    BEGIN
         select test_seq.nextval into new_id from dual;
         :new.sPrimaryKey := 'AAA' || new_id;
    END;
    I have created a BC4J. How can I insert a new row into that table without providing the primary key, by hand, and let the trigger and sequence do that?
    Thank you!
    Razvan

    In the attribute settings editor for the Attribute TestIdPk in Entity Test:
    select Updateable Never
    deselect Mandatory
    select Refresh After Update & Refresh After Insert
    HTH.
    Thanks, George

  • Primary key problem using with oc4j

    Hi everyone
    I have deployed my entity bean in the oc4j container without any problem.But when I use the search->primary key in the console,no results display.
    detail:
    Step1I open the oc4j console by typing java -jar orion.jar -console
    the oc4j container is successfully built
    and in the left part of my console I see my entity bean
    step2 I click my entity bean and in the right of the console in the search->primary key I type the a number which exists in my table in the database.
    but no results display.
    the following is my datasource-file anf orion-ejb-jar file
    data-sources.xml
    <?xml version="1.0"?>
    <!DOCTYPE data-sources PUBLIC "-//Evermind//- Data-sources configuration" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
    <data-sources>
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="jdbc/OracleDSCore"
              location="jdbc/OracleDSCore"
              pooled-location="jdbc/OracleDSPooled"
              xa-location="jdbc/xa/OracleDSXA"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="SCOTT"
              password="TIGER"
              url="jdbc:oracle:thin:@localhost:1521:b2b"
         />
    </data-sources>
    orion-ejb-jar.xml
    <?xml version = '1.0' encoding = 'GBK'?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar>
    <enterprise-beans>
    <entity-deployment name="EMP" data-source="jdbc/OracleDSCore" table="EMP" >
    <primkey-mapping>
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="EMPNO"
    persistence-name="EMPNO" persistence-type="VARCHAR2(4)"/>
    </fields>
    </cmp-field-mapping>
    </primkey-mapping>
    </entity-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="&lt;default-ejb-caller-role>" impliesAll="true"/>
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>
    Any answer is welcome. Thankou in advance!

    Fernando,
    I see you suffer a lot with ADF...write me at [email protected] and let´s keep in touch.
    Maybe we can do a Brazilian list for JDev/ADF.
    Regards,
    Marcelo Alcantara

  • Help with primary key problem

    Oracle 9.2.0 on Red Hat Linux advanced server 2.1
    (There are a number of large tables that this applies to)
    I have a partitioned table where during the creation of the table a Primary key was declared and was placed 'using index tablespace primary_key'. So the table is created, and the primary key is set to use the 'primary_key' tablespace.
    Since our loads are quite large, we disable constraints during the load process, then enable them after the load has completed. Here's the problem, when the constraints are enabled, the tablespace for constraints change to the default tablespace of the schema owner.
    We have a specific tablespace created to hold the primary keys of the various tables, called 'primary_key'. The schema owner has his own default tablespace called 'POWER1'. When the schema owner runs the enable script to enable the primary keys, they all start being placed in 'POWER1' which is not nearly as large as 'primary_key' and as a result the first couple primary keys are created in 'POWER1' and then 'unable to extend segment in tablespace POWER1' pops up and the rest of the primary keys fail to enable.
    The workaround for this is to set the default tablespace for the schema owner to to be 'primary_key' but that is not what we really want.
    any feedback on this is appreciated, thanks

    In the old days, when we disabled a primary constraint, Oracle dropped the index. When we re-enabled the constraint the index was built again. But, if we didn't specify the index tablspace when we re-enabled the constraint the index was built in the default tablespace. Which is what is happening to you now.
    In 9i Oracle added the KEEP INDEX clause, which allowed us to retain the index even though the primary key was no longer enforced. However, as your aim is to increase the speed of data take on, you in fact want the index dropped. So, what you need to do is:
    ALTER TABLE whatever DISABLE PRIMARY KEY
    DROP INDEX;
    ALTER TABLE whatever ENABLE PRIMARY KEY
    USING INDEX TABLESPACE indx;Cheers, APC

  • Oracle 10g express edition primary key problem

    Hi , i have a database with varchar as primary key eg.SEG. however after i insert row and set priamry key as SEG , the primary key will be displayed as number eg.1 and not SEG. Why is it so?

    835401 wrote:
    Table Data Indexes Model Constraints Grants Statistics UI Defaults Triggers Dependencies SQL
    CREATE TABLE "TEST_DEPARTMENT"
    (     "DEPT_CODE" VARCHAR2(10) NOT NULL ENABLE,
         "DEPT_NAME" VARCHAR2(50),
         CONSTRAINT "TEST_DEPARTMENT_PK" PRIMARY KEY ("DEPT_CODE") ENABLE
    CREATE OR REPLACE TRIGGER "BI_TEST_DEPARTMENT"
    before insert on "TEST_DEPARTMENT"
    for each row
    begin
    select "TEST_DEPARTMENT_SEQ".nextval into :NEW.DEPT_CODE from dual;
    end;
    ALTER TRIGGER "BI_TEST_DEPARTMENT" ENABLE
    This is my SQLSo why is DEPT_CODE defined as VARCHAR2(10) when you are going to populate it (via the trigger) with a NUMBER?

  • Entity bean - Unknow primary key problem

    Hi,
    We are using entity bean with unknown primary key option to generate the primary key automatically. It works for all the tables except one table. What we observe is, auto generated primary key is less than the max value in the table and is clashing with one existing record. Any thoughts on what could be wrong?
    Your help is highly appreciated.
    Regards,
    Chandra
    Edited by: Chandrashekhar Singh on Mar 3, 2008 6:39 PM

    Hi,
    I think Vladimir's answer can help you.
    [Entity bean - getting Duplicate Key Exception on ejbCreate;
    Regards
    Pavel

  • Primary key problem

    dear member i have a table
    podtl
    pono number
    item number
    stcode number
    sizecode number
    i want to create a composite primary key
    i will try that query
    alte table podtl
    add constraint primany key (pono,item,stocde,sizecode);
    i have 45000 record this table
    but i have see error
    ERROR at line 2:
    ORA-00902: invalid datatype
    any one help me
    Thanks

    I don't see why that should be:
    SQL> CREATE TABLE podtl (
      2  pono number,
      3  item number,
      4  stcode number,
      5  sizecode number)
      6  /
    Table created.
    SQL> ALTER TABLE podtl
      2  ADD CONSTRAINT podtl_pk PRIMARY KEY (pono,item,stcode,sizecode)
      3  /
    Table altered.
    SQL> Cheers, APC

  • Updating primary key problem

    Here is my scenario:
    I have inserted 5 rows in mobile client with primary key 1, 2, 3, 4,5
    Then deleted 3rd row and updated the primary key for 4th and 5th row to make the primary key sequential.
    But when I sync, I get conflict error with DML Operation update
    Does oracle lite support primary key update or primary key reshuffle?
    Thanks

    Hi,
    can you apply this one-off patch 7337669 Oracle Database Lite: Patch
    CONSOLIDATED ONEOFF FOR CUSTOMER BUGS TILL AUG 19 2008 10.3.0.1.0 19-AUG-2008
    and tell me if you are still able to reproduce this behavior?
    The Patch is available on metakink.oracle.com
    Regards.
    Marc

  • Can I modify primary key or I need to drop it to create another overhide?

    I am getting this issue when I try to create another primary key in my table. The example bellow express the situation.
    TABLE AAA
    (ID
    NAME
    REGISTER)
    PK: ID
    I cannot drop the primary key, cause the table have some FK, so, I was thinking about to try "modify" this key (to put too other field), but I have not found one way to do it, I think just I can drop out the FKs, drop PK after, and create another new primary key after all, but this issue can be bring on a big trouble with other tables, there is another way to fix it, modifyng or just overhide the key?
    Thanks all and apologize about my bad english!

    Disable the refrencing FKs, then drop and recreate the PK. You will also have to modify the FKs. You can, alternatively, create a unique constraint on the new column combination.

  • FindByKey with Composit Primary key

    Hi
    View Object based on Entity Object. Database table defined with Composit Primary Key.
    I have to query ViewObject using findByKey().
    Can any one help me how to use findByKey() using a composit primary key in ADF 11g.
    Thanks

    Hi,
    this is covered in the developer guide here:
    38.1.7 Understanding When You Can Use Partial Keys with findByKey()
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcadvvo.htm#ADFFD1189
    The key thing is to have your object types casted correctly or else null for your composite key.
    Brenden

  • Problems with database modelling and primary keys

    Hi,
    I use JDeveloper exclusively for data modelling and generating the sql to build my db.
    Its good but i have found a bug that can be rather annoying:
    If i change the primary key of a table, the change does not seem to register within the model. So when i try and create a foreign key relationship to another table, the type is of the old type (say i went from varchar2 to number).
    The only way around this is to delete the table and create it again. This also causes problems because the db generation wizard will then refuse to open properly (because it does not know that a table has been deleted).
    Is this a known issue?
    Cheers
    Rakesh

    Is this forum meant for reporting bugs or not? This issue i have stated is repeatable and in the current version.
    R

  • Problem with JPA Implementations and SQL BIGINT in primary keys

    I have a general Question about the mapping of the SQL datatype BIGINT. I discovered, that there are some different behaviour depending on the JPA implementation. I tested with TopLink Essentials (working) and with Hibernate (not working).
    Here is the case:
    Table definition:
    /*==============================================================*/
    /* Table: CmdQueueIn */
    /*==============================================================*/
    create table MTRACKER.CmdQueueIn
    CmdQueueInId bigint not null global autoincrement,
    Type int,
    Cmd varchar(2048),
    CmdState int,
    MLUser bigint not null,
    ExecutionTime timestamp,
    FinishTime timestamp,
    ExecutionServer varchar(64),
    ScheduleString varchar(64),
    RetryCount int,
    ResultMessage varchar(256),
    RecordState int not null default 1,
    CDate timestamp not null default current timestamp,
    MDate timestamp not null default current timestamp,
    constraint PK_CMDQUEUEIN primary key (CmdQueueInId)
    The java class for this table has the following annotation for the primary key field:
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "CmdQueueInId", nullable = false)
    private BigInteger cmdQueueInId;
    When using hibernate 3.2.1 as JPA provider I get the following exception:
    avax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
    at $Proxy16.persist(Unknown Source)
    at com.trixpert.dao.CmdQueueInDAO.save(CmdQueueInDAO.java:46)
    at com.trixpert.test.dao.CmdQueueInDAOTest.testCreateNewCmd(CmdQueueInDAOTest.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at
    Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
    at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:35)
    at org.hibernate.id.IdentityGenerator$BasicDelegate.getResult(IdentityGenerator.java:157)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2108)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2588)
    at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
    at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
    at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
    ... 34 more
    This means, that their ID generator does not support java.math.BigInteger as datatype.
    But the code works if I take TopLink essentials as JPA Provider.
    Looking at the spec shows the following:
    In chapter 2.1.4 "If generated primary keys are used, only integral types will be portable." Integral datatypes are byte, short, int, long and char. This would mean, that the Hibernate implementation fits the spec but there seem to be a problem in general with BIGINT datatypes.
    I use a SYBASE database. There it is possible to declare a UNSIGNED BIGINT. The range of numbers is therefore 0 - 2^64 - 1. Since in Java a long is always signed it would mean its range is from -2^63 -1 to 2^63 -1. So a mapping of BIGINT to java.lang.long could result in an overflow.
    The interesting thing is, that I used NetBeans to reverse engineer an existing database schema. It generated for all Primary Keys of Type BIGINT automatically a java.math.BigInteger. But for other fields (not being keys) it mapped BIGINTs to java.lang.long.
    It looks like there are some problems with either the spec itself or the implementation of it. While TopLink seems to handle the problem correctly, Hibernate doesn't. But Hibernate seems to fulfill the spec.
    Is anybody familiar with the Spec reading this and can elaborate a little about this situation?
    Many thanks for your input and feedback.
    Tom

    Not sure if I clearly understand your issue, would be good if you can explain it a bit more clearly.
    "I select a value from LOV and this value don't refresh in the view"
    If you mean ViewObject, check if autoSubmit property is set to true.
    Amit

Maybe you are looking for