Problems Engineering Surrogate Primary Key with Unique Key

SDDM 3.3.0.747 with 2 problems (at least so far).  I am hoping that the problem is with this SDDM rookie and I have overlooked some setting. PROBLEM 1 I don’t want to start a religious debate about surrogate vs. natural keys but I am having a problem engineering both correctly from the logical model.  I am a rookie when it comes to SDDM but have many years of experience with Designer. By default I like to have both a natural UID  (UK) and a surrogate key based primary UID (PK) which is used for foreign keys.  The problem I am having with engineering is I can successfully engineer the surrogate PK’s, engineer the FK’s using the PK’s but cannot get the unique key to contain the surrogate keys in the child table.  If I check the identifying property in the relations, the PK columns and the UK columns are included in the child PK and the UK contains no columns. The Setup I have defined two reference entities, PROBABILITY and SEVERITY with natural unique keys defined.  I also have a child entity RISK_ASSESMENT with relationships back to the PROBABILITY and SEVERITY entities and both have the “Use surrogate keys:”: check box checked.  The unique key for the RISK_ASSESMENT entity includes the relationships back to PROBILITY and SEVERITY.  None of the entities have a PK or surrogate key defined and they all have the “Create Surrogate Key” check box checked.  In addition the following preferences are set: Data Modeler/Model/Logical   NOT Checked - Use And Set First Unique Key As Primary Key   NOT Checked – Name – Keep as the name of the Originating attribute   Checked – Entity Create Surrogate Key   Checked – Relationship Use Surrogate Key PROBLEM 2 When the foreign key columns are engineered I want the names to have a prefix “FK_” but they don’t.  Templates are set as follows: Data Modeler/Naming Standard/Templates   Foreign Key:  FK_{child}{parent}   Column Foreign Key:  FK_{ref column} Engineer to Relational Model/General Options   Checked - Apply name translation Marcus Bacon

I have been switching between SD 4 EA1 and SDDM 3.3 trying to get things to work and trying out the template table for adding audit columns (really nice!).
Concerning Problem1.  No matter what settings I use and whether I use SDDM 3.3 or SDI cannot get the FK columns to be included in the UK even though the relations are included in the UID in the entitty.  When I open the properties of the child table and click on the naming standards button and click ok it complains that the UK is not complete.  I add the FK columns to the UK and all is well including the naming standards.
Concerning Problem 2.  Sometimes it engineers the names for FK's from the template and sometimes it doesn't.  Didn't see a pattern.  Gave up trying and used Naming Standards button.  I still had to change a few.
The good new is, that after make changes needed in UK's and Column names of 18 tables, I know have everything deployed to Test except FK Indexes.  I think I have to do those by hand.
Marcus Bacon

Similar Messages

  • Problem in dropping primary key

    Hi,
    I have table EMP which has a primary key on EMPNO column.
    I want to drop the primary key with the below statement:
    "alter table emp drop primary key"
    It's showing error as "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    I'm totally confused how the error is creeping into it.
    Could anyone help me out.
    Thanks in advance,
    Souvik

    See here ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>create table test_souvik
      2      (
      3       id  number(10) not null,
      4       descc varchar2(30),
      5       constraints pk_iid primary key(id)
      6      );
    Table created.
    Elapsed: 00:00:02.10
    satyaki>
    satyaki>
    satyaki>insert into test_souvik values(1,'SOUVIK');
    1 row created.
    Elapsed: 00:00:00.04
    satyaki>
    satyaki>insert into test_souvik values(2,'SATYAKI');
    1 row created.
    Elapsed: 00:00:00.02
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from test_souvik;
            ID DESCC
             1 SOUVIK
             2 SATYAKI
    Elapsed: 00:00:00.29
    satyaki>
    satyaki>
    satyaki>insert into test_souvik values(2,'BILLY');
    insert into test_souvik values(2,'BILLY')
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.PK_IID) violated
    satyaki>alter table test_souvik drop constraints pk_iid;
    Table altered.
    Elapsed: 00:00:02.76
    satyaki>
    satyaki>insert into test_souvik values(2,'BILLY');
    1 row created.
    Elapsed: 00:00:00.03
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>select * from test_souvik;
            ID DESCC
             1 SOUVIK
             2 SATYAKI
             2 BILLY
    Elapsed: 00:00:00.08
    satyaki>Regards.
    Satyaki De.

  • Batch processing problem: Seeing the primary key (id) in the test cases...

    Another problem we seem to be having is how to read the primary key into a base attribute of an entity.
    In batch processing, we may define the "id" as the primary key on the table. We need to get that id and the foreign key ids into the base attributes in the rule set...
    How do we go about doing that?

    Perhaps better, if you could give me a sample xml config with global and one entity. The only attribute in the entity should be the id... The id should be the primary key in both OPA and Oracle...
    The global table in oracle would contain a single column with the global id.
    The child table in oracle would contain 2 columns -> one for the global ref id and one for the child key...
    I think you will find problems.
    As a note we have duct-tape solved this by creating views and making column copies in the views of the child id and then mapping the id in oracle to the duplicate column in the view.
    So our child view contains the child table with the child id repeated twice so that we can map...

  • Problems deleting a primary key field in a table.

    Hello Guys,
    I deleted a primary key field in a custom table by clicking 'delete row' icon and then tried activating it through se14 - database utility. It is throwing an error saying 'Primary key change not permited for the value table zxxxx'. What is the problem???
    How can I delete a primary key in a table??
    Please help.
    Thanks,
    Naren

    I am pasting the detail explaination over that error.
    Primary key change not permitted for value table ZTV_RANGE_NUMBER
    Message no. AD 300
    Diagnosis
    This table is defined as a check table. For reasons of consistency, changes to the primary key of the table are not allowed.
    Procedure
    If it is essential that you change the primary key, you must delete the relevant foreign keys. Refer to the where-used list to find all tables containing a field that is checked against this table. Delete the foreign keys for these fields.
    If necessary, maintain the deleted foreign keys again.

  • Problems referencing a primary key field in a master-detail

    Hello,
    I am making an application where I have a master-detail page.
    In the detail section it is possible to add new rows using the standard "Add row"-button that the wizard creates.
    The detail section has a column with a link in it. This link leads to another part of the application.
    When I press this link I would like to send the field "Id" of the current detail row to the page which the link redirects to.
    So far I have concluded that the primary key field "Id" of the detail is only filled out after I do a submit. So I have my column link set up to do:
    javascript: doSubmit('NAVIGATE_1');
    In the branching I am testing on the :REQUEST object to see if it contains 'NAVIGATE_1' - I can't seem to get the value from the "Id" field though. I tried to add #ID# in the javascript submit call - but since the "Id" is filled only after I submitted then this doesnt really work at all.
    Does anyone have an idea on how to make this work in APEX ? Its probably some simple thing that I just didnt think of yet ;)
    Kind regards
    Bo Normann

    I found a way. I dont like it - but it works.
    I made a column link in the detail with the following:
    javascript: doSubmit('NAVIGATE@#ROWNUM#);
    This way I obtain information in the :REQUEST object about which row was clicked.
    In a After submit process on the page I then parse this :REQUEST object like this:
    DECLARE
    v_row NUMBER;
    v_pos NUMBER;
    BEGIN
    v_pos := instr(:REQUEST,'@',-1);
    v_row := substr(:REQUEST, v_pos+1);
    IF APEX_Application.g_f02(v_row) IS NOT NULL THEN
    :P_PRIMARY_KEY_ID:= APEX_Application.g_f02(v_row);
    ELSE
    :P_PRIMARY_KEY_ID:= -1;
    END IF;
    END;
    I know that my "Id" column is named f02 in the form, so this way I can find the id. I then assign this id to a kind of global variable - on the page I redirected to I can now find the Id.
    Talk about ugly code :P

  • Problem on getting Primary Key in CMP from a Sequence

    hi friends,
    please examin the code,
    // PersonVO.java
    public class PersonVO impelemnts java.io.Serializable{
    // construtctors
    // getter and setter methods
    private int id;
    private String name;
    // PersonEJB.java
    abstract public class PersonEJB implements EntityBean{
    abstract public void setId(int id);
    abstract public void setName(String name);
    abstract public int getId();
    abstract public String getName();
    public int ejbCreate(PersonVO data){
    setId(data.getId());
    setName(data.getName());
    return null;
    // Other callback methods
    // Application logic methods
    Problem :
    the field id of the table is a sequence. how can i get the next value from the table in the ejb.
    i wand to set that value to the
    setid(...) method
    instead of
    setId(data.getId());
    please help......

    Why are you defining a primery key class (PersonVO) for your EJB ?
    If you have not a compound primary key, you dont need define a primary key class like PersonVO, you just have to define an ejbCreate (int id).
    Fil

  • Deployment Tool Problem (J2EE -Composite primary Key Class)

    Hi !!
    e.g. I have an entiybean which has composite primary key class. So while deploying in J2EE tool u need to specify the Primary key class and the primary key field. well in case of a composite primary key class(if u have more than one field)...how do u declare all the fields for primary key class....
    if u r not getting me please tell me... See in J2EE deployment tool there is on section called Entity..in that see the Primary Key class (there u specify the Primary key class) and the Primary Key Field Name (the field name) Here u can just give only one Field name..if you have mulitple fields, then where you will specify... Please let me know..
    if anybody wants the code I will give the code...Please try to help..(how to deploy this kind of entity bean in J2EE deployment tool)
    -Bhumika

    Hi Bhumika,
    in case you have more than one field you need to write a Primary key class where the fields you want to be the key are member variables.
    your p.key class could look like this (it has to implement hash() and equals() ):
    public class PersonPK implements java.io.Serializable
    public int person_ID;
    public PersonPK()
    public PersonPK(int aPersonId)
    person_ID = aPersonId;
    public int hashCode()
    return person_ID;
    public boolean equals(Object ob)
    if (ob == this) return true;
    if (!(ob instanceof PersonPK)) return false;
    PersonPK other = (PersonPK) ob;
    if (person_ID != other.person_ID) return false;
    return true;
    -Hope this helps a bit,
    Anke

  • Master Detail Forms with 2 composite primary keys - Is there a workaround?

    Hello All,
    I have been searching for a workaround to the maximum 2 part primary key restriction on the multi-row updates, and master-detail forms, and am hoping that someone can help me. I am using HTMLDB v2.0.0.00.49 with IE 6 against a 9.2 DB.
    I successfully implemented the workaround of Fred Stoopendaal's (see Updata PK on HTML DB ) and it works fine for single page multi-record updateable forms, but alas I haven't been able to extend it to master detail forms (I think it is something to do with Oracle not allowing the "returning" clause on views).
    Here is what I tried:
    two tables, one with a 2 part composite primary key, which is the master table, and a detail table with 3 part composite primary key -
    --------- BEGIN SQL ---------
    create table master_table
    ( master_col1 number
    , master_col2 number
    , master_col3 varchar2(30)
    , constraint master_pk primary key (master_col1,master_col2));
    create table detail_table
    (detail_col1 number
    ,detail_col2 number
    ,detail_col3 number
    ,detail_col4 varchar2(30)
    , constraint detail_pk primary key(detail_col1,detail_col2,detail_col3)
    , constraint master_detail_fk foreign key (detail_col1,detail_col2) references master_table(master_col1,master_col2));
    create or replace view v_master_table as
    select rowid mata_rowid,mata.*
    from master_table mata;
    create or replace view v_detail_table as
    select rowid deta_rowid,
    (select rowid from master_table mata where mata.master_col1 = deta.detail_col1 and mata.master_col2 = deta.detail_col2) deta_mata_rowid
    , deta.*
    from detail_table deta;
    create or replace trigger mata_ins_upd_trg
    instead of insert or update on v_master_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into master_table (master_col1, master_col2, master_col3)
    values (:new.master_col1, :new.master_col2, :new.master_col3);
    end if;
    if updating then
    update master_table
    set master_col1 = :new.master_col1,
    master_col2 = :new.master_col2,
    master_col3 = :new.master_col3
    where rowid = :old.mata_rowid;
    end if;
    end;
    create or replace trigger deta_ins_upd_trg
    instead of insert or update on v_detail_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into detail_table ( detail_col1, detail_col2, detail_col3, detail_col4)
    values (:new.detail_col1, :new.detail_col2, :new.detail_col3, :new.detail_col4);
    end if;
    if updating then
    update detail_table
    set detail_col1 = :new.detail_col1,
    detail_col2 = :new.detail_col2,
    detail_col3 = :new.detail_col3,
    detail_col4 = :new.detail_col4
    where rowid = :old.deta_rowid;
    end if;
    end;
    --------- END SQL ---------
    Then I created a master-detail form in Apex on the two views, using the mata_rowid and deta_rowid as primary keys, and mata_rowid=deta_mata_rowid as the link. I realise that using a function to fetch the master rowid within the detail view query is costly, but it was my intention to modify the record fetch queries to use the real FK columns once things were up and running.
    It seems to generate the pages ok, and I can insert/update master table records, but as soon as I modify records in the detail table things go a bit haywire. I can't find any documentation on how the inbuilt MRU/MRD logic works, so can't figure out the issue.
    Can anyone out there tell me what the problem is with the logic above, or if they have come up with a neat solution to this annoying limitation. I know that many will say that I should modify the data model to use surrogate primary keys, but many of the uses for HTMLDB are new interfaces for old schemas, so a workaround that doesn't involve wholesale data model changes would be preferable.
    Thanks in advance,
    Mike Cretan

    Hi, this is likely not the most elegant way...but perhaps the simplest -- and I didn't have much time to play.
    I used Wizard to create two separate Master Detail forms, each with a separate detail table. Thus I ended up with four pages:
    Page "A" - "Selector" page for Master (Report), with Edit link driving to Detail-1
    Page "B" - Editable Master/Detail-1 page (HTML / Report)
    Page "C" - "Selector" page for Master (Report), with Edit link driving to Detail-2
    Page "D" - Editable Master/Detail-2 page (HTML / Report)
    Then I selected the primary key column TWICE on the Report on Page A. Modified the second instance of this column to navigate to Page D (passing primary key) exactly the way the original instance of this column navigates to Page B. Then I deleted Page C.
    Since you can have only one Tabular Entry form per page, this seemed the best way to drive two separate detail tables from a common interface.

  • Why should primary key be the first column in a table

    Hi,
    I'm trying to build a case to alter a table in production with a composite key . I have  PK columns at the start of table which is how it should be , but the issue is down the line , another column was added at the end and the same was added to composite
    key .
    issue is as PK arranges records physically where it creates a clustered index, as far as my knwoledge goes,  data is ordered initially by the three fields (composite keys) and then ordered again by another composite key field as they are not
    defined in a set , will this cause any performance bottle necks as it's a stage table to populate a fact if so how ??
     below is the table structure..
    Any help  in this regard is appreciated :)

    PRIMARY KEY as first column is just a convention.
    The PRIMARY KEY columns can be anywhere in a table.
    I don't see any advantage to the 5-column PRIMARY KEY.
    I would design it with INT IDENTITY (or SEQUENCE OBJECT) SURROGATE PRIMARY KEY.
    You can make the 5-columns a UNIQUE key or unique index.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Primary Key on Char + Form Report Edit

    Hello all,
    i'm new here :)
    I have a question regarding Apex 3.0
    I created a table with a primary key on char(5).
    After that I created a form with report.
    If i click now on the edit button in the report on a row, I receive this error on edit page:
    ORA-01403: no data found
    Unable to fetch row.
    If the "id" is a int, it works without problems
    Could someone help me?
    Message was edited by:
    schulle

    Hi,
    When you go to page 3 in edit mode, you give a value to P3_QNR (the PK).
    If this value doesnt exist in your table, you'll get the following error : ORA-01403: no data found - Error Unable to fetch row.
    From what I understand of your problem, if you change de datatype of your primary key, you can fix/create the same error.
    after some testing : I was able to have the same error... and fix it
    The problem : if your primary keys starts or end with blank spaces, APEX can't handle it (in the url, APEX don't add %20 to replace the blank spaces)
    The fix : make sure your primary keys don't start or end with blank spaces
    I hope this help
    go see this thread : Re: Bug - primary key with datatype char starting or ending with blank spac
    Flex
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

  • Locking Down a Primary Key Value

    What is the best way to guarantee that a primary key field value cannot be changed? Should I use a trigger to prevent such attempts? If so, what would the trigger script look like? This is a problem because the primary key will be used as a foreign key in other tables, and its value should never change once set. Thanks in advance.
    Evan

    If foreign key constraints are in place, Oracle won't allow you to change a primary key in the parent table if there is a record in the child table that depends on that value.
    Depending on the application design, you may be able to do things such as not grant UPDATE privileges on the primary key column to the users.
    You could also write a trigger that would prevent modifications, though that would tend to be a bit of overkill. Something like
    CREATE OR REPLACE TRIGGER no_change_primary_key
      BEFORE UPDATE OF <<primary key column>> ON <<table>>
      FOR EACH ROW
    BEGIN
      RAISE_APPLICATION_ERROR( -20001, 'Dude.  You cannot change the primary key!' );
    END;
      1  CREATE OR REPLACE TRIGGER no_change_primary_key
      2    BEFORE UPDATE OF empno ON emp
      3    FOR EACH ROW
      4  BEGIN
      5    RAISE_APPLICATION_ERROR( -20001, 'Dude.  You cannot change the primary key!' );
      6* END;
    SCOTT @ HP92 Local> /
    Trigger created.
    SCOTT @ HP92 Local> update emp set empno = 1 + empno;
    update emp set empno = 1 + empno
    ERROR at line 1:
    ORA-20001: Dude.  You cannot change the primary key!
    ORA-06512: at "SCOTT.NO_CHANGE_PRIMARY_KEY", line 2
    ORA-04088: error during execution of trigger 'SCOTT.NO_CHANGE_PRIMARY_KEY'Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Having a problem with creating/using a primary key on a view

    I have a problem with a primary key on a view
    I created the view and primary key as follows:
    CREATE OR REPLACE FORCE VIEW "MDD"."ROCK_LU" ("DESCRIPTION",
         UNIQUE ("DESCRIPTION") RELY DISABLE,
         CONSTRAINT "ROCK_LU_PK" PRIMARY KEY ("DESCRIPTION") RELY DISABLE) AS
    SELECT DESCRIPTION
    FROM MRMC_LU
    WHERE ROCK = 'T';
    The view with the primary key appears to have been created as there were no error messages. (The above was from the sql tab in sql developer.)
    When I try to create the foreign key on my mdd_hr table - I get an error
    /* hr_name - foreign key */
    ALTER TABLE mdd_hr add CONSTRAINT hr_name_fk FOREIGN KEY (hr_name) REFERENCES rock_lu(description);
    Error report:
    SQL Error: ORA-02270: no matching unique or primary key for this column-list.
    When I lookup the index in sql developer, rock_lu_pk is not there.
    All my other foreign keys work - but I don't understand what I am doing wrong with this one. Please help.
    glenn
    Background - as to why I want to use a view as a lookup table.
    The MRMC_LU table that the view is created from is structured like:
    DESCRIPTION - MINERAL - ROCK - MODIFIER - COMMODITY
    ANHYDRITE - T - T - T
    APLITE - T - - T
    GRAPHITE - T - - - T
    GREYWACKE - - T
    DESCRIPTION is a list of all names of minerals, rocks, modifiers and commodities. T is entered in each valid field. Often a description name is used for both a mineral and a rock or a mineral and a commodity or any other combination. Because this database is just starting up, it was more efficient to create one table that could be updated (and thereby automatically update the MINERAL_LU, ROCK_LU, MODIFIER_LY, COMMODITY_LU views) rather than create and maintain four separate but similar tables. A primary key cannot be generated for the MRMC_LU table as there are nulls in each column
    except DESCRIPTION.
    Perhaps there is a smarter way to do this?

    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.

  • 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

  • Problem with a primary key when creating a new record in Forms

    My table has a field - MDD_KEY - that is a primary key. It is updated from a sequence with a before-insert database trigger. I know this works properly as the primary key was accurately populated when I inserted 1433 records.
    In Forms 6, I have a form based on that table. I have set the mdd_key as a hidden field because I assume it will be entered by the before-insert trigger. However, when I enter data into the table, and then try to save it, I get a FRM-40202: Field must be entered. - followed by - FRM-40222: Disabled item MDD_KEY failed validation.
    If I set DATA Required to no, when I try to save I get an FRM-40600: Record has already been inserted - but no such record exists in the database. I know this record is unique and does NOT exist because I deliberately made it up.
    In the property palatte, the attributes of the field are:
    DATA Data Type Number
    Required Yes
    DATABASE Database Item Yes
    Primary Key Yes
    Query Only No
    Query Allowed Yes
    Query Length 0
    Insert Allowed Yes
    Update Allowed Yes
    Update Only if Null No
    Lock Record No
    I assume that my problem is that with a new record, the form wants to see the MDD_KEY populated before it saves - but that isn't going to happen until the before insert trigger fires in the database. I assume I have to populate that field within forms, but how do I do that without messing up the database trigger/sequence? I will have to load more data directly into the database - so I need the database trigger in place.
    I have not used primary keys before so I am more than a little bit confused about how and when it should be populated when a new record is created in Forms.
    Any help would be appreciated as I cannot enter new data into my form (works well with existing data).
    Thanks
    Glenn

    hi
    if u have any problem using seq then try that statemetn ur block level in ur form
    PRE-INSERT trigger
    select nvl(max(nvl(srno,0)),0)+1 into :srno from tablename;
    Rizwan

  • 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.

Maybe you are looking for