Java Dictionary Primary Key

Hello,
  I'm creating some database tables in the Java Dictionary on Web AS 6.40.  What is the best way to create unique identifiers for the primary key of these tables?  In ABAP Dictionary you would use a number range.  Is there an equivalent or other technique for the Java Dictionary?
Thanks,
Dustin

Hi Dustin,
the best way is if the logic of your data represent a primary key. If your central data object for example is a project, it will have a project number, and this is unique, so predestinated to be the primary key. If a customer has an order for this project (maybe the project is handled via two or three single orders), you will have an "order" table. For single customers having unique order IDs, the combination of the customers order id and the project id (foreign key) are predestinated to be the primary key.
If such a logic does not work, it's up to you to implement something (automatic PK generation does not work with the Java Dictionary). A number range seems to be ABAP... I would prefer a PKGenerator, for example generating them out of a combination of timestamp and random number or chars (sure, managing that the generated keys are unique).
Hope it helps
Detlev

Similar Messages

  • Data Dictionary-Primary keys

    Hi All,
    I have a question regarding creating primary keys in Ztables.
    When I designate a field as Primary Key, It is accepting NULLs as inputs.Which is contradicting Primary key constraint. How should I enforce primary key constraint.

    Even though the Key And Intitial coumn has been set, while entering values in table the field is still accepting Null values.
    for eg- Num (char10/Or any DE attached),
    Name (Char 20). If enter records like
    (<blank>, krishna),
    (10, chaiyanya).
    the PK field is also accepting blank values r if not entered anything also its accepting.
    But this is not the case in any RDBMS. PK (Not Null and unique) is maintained.
    How to go about it.

  • Java Dictionary Project + create autonumber for KEY field?

    Hi there,
    I would like to create a Java Dictionary project that has a table with an AUTONUMBER as the key field.
    I know exactly how to do this in SQL Server using the IDENTITY field but cannot see an option when using the Java Dictionary project?
    Any ideas?
    Thanks for the help
    Lynton

    Has there been an update to this recently?  I am in need of exactly the same information.  The FAQ lists this:
    <i>Can I deploy a Java Dictionary table along with the table content?
    Yes. You can deliver the Java Dictionary table along the table content. There are two possibilities:
    Export from a reference database
    Specification of the table entries in an XML file (since SP5)
    Note that there is no modification support for table entries that are delivered in this way. Therefore, you can deliver table entries with program character or for examples, but not for templates or customizing data.</i>
    Now, I may be reading the note incorrectly, but it makes it sound like if you do populate a table with a XML file, the records cannot be modified thereafter.  Is this true?
    I'd also like to know how to develop the XML and where to put it, etc.  I've had no luck searching for this information.
    Thanks!

  • Primary key allows duplicate entry in data dictionary

    Hi Friends,
                     I have created table to save contact details. here i have assigned USERID and CELL_NO as primary key but when i am trying to create new entry it allows duplicate value. How can i prevent this ?
    Please review my attached image for more details.
    Thank you Friends.

    Hi Karthi,
                  I think table logic is correct. it mean if you entered both primary key same only it wont allow but here you mentioned same cell no but different ID so it will accepts.
    E.g
         cell no 1234
         user id  xxx
         cell no 1234
        user  id xxx
    above logic wont allows
    but you mentioned
    cell no 1234
    user id xxx
    cell no 1234
    user id xyz
    if you need to remove duplicates mean you should maintain primary key as cell no only not both..
    revert back if you didnt get clear.
    Regards,
       Thangam.P

  • How to define Composite primary key for a Table

    Hi ,
    I am basically more into Java Programming , with little bit knowledge on Oracle as DataBase .so please excuse for my silly doubts .
    Can anybody please tell me how to define a Composite Primary Key on a Table .
    Thanks in advance .
    Edited by: user672373773 on Sep 25, 2009 8:54 AM

    Here is an example right out of the Oracle documentation and the syntax for adding PK since you mention adding a composite PK.
    Example creating composite index
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_indexing.htm#sthref594
    Syntax for adding a PK (composite or not)
    alter table oooooooo.tttttttt
    add constraint tttttttt_PK
    primary key (sample_column2,
    sample_column1)
    using index
    tablespace IDXSPC
    pctfree 05
    initrans 04
    maxtrans 08
    storage (initial 16k
    next 16k
    maxextents 32
    pctincrease 0);
    -- dictionary management with restricted storage, change as desired.
    HTH -- Mark D Powell --

  • Help required to generate primary key sequence

    Hello All,
    I need your help in generating a sequence for primary key in my db table created using java dictionary project in my NWDS 7.3.
    The table column EMPL_ID is a primary and needs to be a sequence. The code in the JPA entity is as below. The underlying database is DB2 on Linux. Kindly help me resolve this issue.
    * The persistent class for the TMP_EMPL_DATA database table.
    @Entity
    @Table(name="TMP_EMPL_DATA")
    public class TmpEmplData implements Serializable {
         private static final long serialVersionUID = 1L;
         @Id
         @SequenceGenerator(name="EMPLID_GENERATOR", sequenceName="EMPID_SEQ", initialValue = 10000, allocationSize = 1)
         @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMPLID_GENERATOR")
         @Column(name="EMPL_ID")
         private String _emplId_;
    My bean class contains a public method as follows.
    public TmpEmplData createEmployee(String employeeName, int age, String location)
             TmpEmplData emplData = new TmpEmplData();
             emplData.set_emplName_(employeeName);
             emplData.setAge(age);
             emplData.setLocation(location);
             entityManager.persist(emplData);
             entityManager.find(TmpEmplData.class, emplData.get_emplId_());
             return emplData;
    During execution, i am getting an error as below.
    Caused by: javax.persistence.PersistenceException: The generated SQL statement is not valid for the underlying database platform (platform no. 99). For more details see attached exception. SQL statement is SELECT NEXT VALUE FOR "EMPID_SEQ" FROM ( VALUES (1) )
    at com.sap.engine.services.orpersistence.sqlmapper.mapping.JPASQLMapperImpl.createSequenceIDGeneratorSelectText(JPASQLMapperImpl.java:1239)
    at com.sap.engine.services.orpersistence.entitymanager.CachedJPASQLMapper.createSequenceIDGeneratorSelectText(CachedJPASQLMapper.java:259)
    at com.sap.engine.services.orpersistence.generator.GeneratorFactory.<init>(GeneratorFactory.java:156)
    at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl$MetaDataImpl.<init>(EntityManagerFactoryImpl.java:323)
    at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:137)
    at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.<init>(JtaEntityManagerFactoryImpl.java:39)
    at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createJtaEntityManagerFactory(PersistenceProviderImpl.java:251)
    at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:236)
    at com.sap.engine.services.orpersistence.container.EMFInstanceCreator.getEntityManagerFactory(EMFInstanceCreator.java:134)
    at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getEMF(ORPersistenceObjectFactory.java:300)
    at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getObjectInstance(ORPersistenceObjectFactory.java:73)
    at com.sap.engine.lib.injection.ReferenceObjectFactory.getObject(ReferenceObjectFactory.java:96)
    at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:113)
    ... 122 more
    Caused by: com.sap.engine.services.orpersistence.sqlmapper.generate.SQLMappingException: SQL statement is not valid for underlying database platform.
    at com.sap.engine.services.orpersistence.sqlmapper.common.CommonSQLMappingResult.getStatementString(CommonSQLMappingResult.java:237)
    at com.sap.engine.services.orpersistence.sqlmapper.mapping.JPASQLMapperImpl.createSequenceIDGeneratorSelectText(JPASQLMapperImpl.java:1237)
    ... 134 more
    Caused by: com.sap.sql.tree.StringRepresentationFailureException: Cannot represent next value expression as string.
    at com.sap.sql.tree.impl.OpenSqlTextExpert.nextValueExpressionToText(OpenSqlTextExpert.java:185)
    at com.sap.sql.tree.impl.NextValueExpressionBuilderImpl$NextValueExpressionImpl.toSqlTxt(NextValueExpressionBuilderImpl.java:140)
    at com.sap.sql.tree.impl.AbstractSqlTextExpert.selectSublistToText(AbstractSqlTextExpert.java:130)
    at com.sap.sql.tree.impl.SelectSublistImpl.toSqlTxt(SelectSublistImpl.java:150)
    at com.sap.sql.tree.impl.QuerySpecificationImpl.toSqlTxt(QuerySpecificationImpl.java:361)
    at com.sap.sql.tree.impl.SelectStatementImpl.toSqlTxt(SelectStatementImpl.java:139)
    at com.sap.sql.tree.impl.SQLStatementImpl.toSqlString(SQLStatementImpl.java:75)
    at com.sap.engine.services.orpersistence.sqlmapper.common.CommonSQLMappingResult.getStatementString(CommonSQLMappingResult.java:233)
    ... 135 more

    Hi,
    does the sequence exist? SAP JPA does not support creation of sequences, you have to create it manually.
    Maybe SAP JPA also does not support DB2 sequences with "Open SQL" correctly.
    - Tryp to set your data source to "native" or "vendor".
    - Try to turn on oracle compatibility:
    db2set DB2_COMPATIBILITY_VECTOR=ORA
    Regards
    Rolf

  • Error While Deploying A CMP Entity Bean With A Composite Primary Key

    Hello all,
    I have a problem deploying CMP Entity beans with composite primary keys. I have a CMP Entity Bean, which contains a composite primary key composed of two local stubs. If you know more about this please respond to my post on the EJB forum (subject: CMP Bean Local Stub as a Field of a Primary Key Class).
    In the mean time, can you please tell me what following error message means and how to resolve it? From what I understand it might be a problem with Sun ONE AS 7, but I would like to make sure it's not me doing something wrong.
    [05/Jan/2005:12:49:03] WARNING ( 1896):      Validation error in bean CustomerSubscription: The type of non-static field customer of the key class
    test.subscription.CustomerSubscriptionCMP_1530383317_JDOState$Oid must be primitive or must implement java.io.Serializable.
         Update the type of the key class field.
         Warning: All primary key columns in primary table CustomerSubscription of the bean corresponding to the generated class test.subscription.CustomerSubscriptionCMP_1530383317_JDOState must be mapped to key fields.
         Map the following primary key columns to key fields: CustomerSubscription.CustomerEmail,CustomerSubscription.SubscriptionType. If you already have fields mapped to these columns, verify that they are key fields.Is it enough that a primary key class be serializable or all fields have to implement Serializable or be a primitive?
    Please let me know if you need more information to answer my question.
    Thanks.
    Nikola

    Hi Nikola,
    There are several problems with your CMP bean.
    1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
    2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
    as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
    Do you try to use stubs instead of relationships or for some other reason?
    If it's the former - look at the CMR fields.
    If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
    the CMP container generates the PK values, use the Unknown
    PrimaryKey feature.
    Regards,
    -marina

  • Diff b/w primary key and unique key?

    what is the diff b/w primary key and unique key?

    Hi,
    With respect to functionality both are same.
    But in ABAP we only have Primary key for the Database tables declared in the Data Dictionary.
    Unique is generally is the term used with declaring key's for internal tables.
    Both primary and Unique keys can identify one record of a table.
    Regards,
    Sesh

  • Null value in detail table's primary key

    I use Business Components Data Form to define a master-detail java panel.
    I don't display the primary key column in the detail grid control.
    Then I click on "+" to add a row, enter a value (the 2nd part of the detail table's primary key) and click commit.
    I get an error saying that the primary key column that's not displayed is null and the row cann't be committed.
    How do I fix this error?

    My fields are varchar2's.
    -- simplified to protect the guilty:
    -- (made up from memory, so sql keywords may --be misspelled, but you get the idea)
    create table proj (
    proj varchar2(10) not null,
    constraint proj_pk
    primary key(proj)
    insert into proj values ('abc');
    commit;
    -- this table has legal values for -- the master.legal field.
    -- in master, legal was changed to a -- ComboBoxControl control from -- TextFieldControl that the wizard -- generated.
    create table legal_values (
    proj varchar2(10) not null,
    legal varchar2(10) not null,
    display_order integer not null,
    constraint legal_values_pk
    primary key (proj, legal)
    insert into legal_values
    values ('abc', 'one', 1);
    insert into legal_values
    values ('abc', 'two', 2);
    insert into legal_values
    values ('abc', 'three', 3);
    commit;
    create table master (
    proj varchar2(10) not null,
    masterKey varchar2(15) not null,
    legal varchar2(10) not null,
    constraint master_pk
    primary key (proj, masterKey)
    create table detail (
    proj varchar(10) not null,
    masterKey varchar(15) not null,
    detailkey varchar(10) not null,
    display_order integer not null,
    status varchar2(12) not null, -- user can only update this field
    constraint detail_pk
    primary key(proj, masterkey, detailkey)
    -- legal rows for detail table
    create table detail_values (
    proj varchar2(10) not null,
    detailkey varchar2(10) not null,
    display_order integer not null,
    constraint detail_values_pk
    primary key(proj, detailkey)
    insert into detail_values values
    ('abc', 'status a', 1);
    insert into detail_values values
    ('abc', 'status b', 2);
    commit;
    -- if their is a foriegn key on details back
    -- to master, then you get the
    -- "mutating table" error when trigger
    -- occurs.
    create or replace trigger master_tr
    after insert on master
    for each row
    begin
    insert into detail
    (masterKey, detailKey, status, display_order, status)
    select :new.masterkey, detail_key, display_order, ' '
    from detail_values;
    end;
    -- detail.status is a comboboxControl getting --its values of of another db table too.
    -- there's also "after update" triggers on master and detail tables that copy the record to master_history and "detail_history" tables if the corresponding table is modified. Thus we have a history of the changes made to the records. The 2 history tables have 2 additional fields than their parents, "modified_date date default sysdate not null" and "modified_by varchar2(30) default user not null" that record when and who made the change. There's also a change type field that records where the change is an insert, delete or update (there 3 triggers per table , so we can correctly record change type as being insert, delete or update into the change_type field).
    If you want to make it more real to life, the status value is initially blank, then can be changed to a legal status value (complete or not complete), but can not be changed back to blank.
    ***P.S. I have to have this ready for production by monday.****
    P.P.S After you reply and change to ComboBoxControls in 2 places, try changing the table names and/or the column names (say to follow the DBA's naming convention) or add another field to the composite primary key (and unstated foriegn key) (using drop table/create table). Now try getting the existing code to run. No writing down the old/new table (or column) name pair names. Just run the code and try to fix the code based on the error messages. Are the error messages giving you adequate information to find the problem?

  • How do I create an Entity Bean with unknown primary keys

    Hi,
    Can a good folk help me.
    I am mapping an entity bean to an oracle table for the purpose of logging . I do not need a primary key contraint on this table. How do I specify in my entity bean file descriptor not to use any field for primary key ...
    I have done this so far...
    in my ejb.xml file - I set....
    <prim-key-class>java.lang.Object</prim-key-class>
    and deleted ....
    <primkey-field>...</primkey-field>
    My table structure is .....
    CREATE TABLE FAMS_REQUEST_LOG (
    EDITEDBY VARCHAR2(20),
    OLDTRANSDATE DATE,
    REQUESTID VARCHAR2(30) NOT NULL,
    OLDQTY NUMBER(20),
    NEWQTY NUMBER(20),
    NEWTRANSDATE DATE)
    but I still get this error message on deploying...
    [#|2006-03-01T14:30:29.250+0100|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 11000 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%|#]
    [#|2006-03-01T14:30:29.265+0100|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Fatal Error from EJB Compiler -- JDO74046: JDOCodeGenerator: Caught a MappingConversionException loading or creating mapping model for application 'fixassetenterpriseapp' module 'FixAssetEnterpriseApp-EJBModule': JDO71030: There is no column in table FAMS_REQUEST_LOG which can be used to support the servers implementation of unknown key classes.
    at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274)
    at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615)
    at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563)
    at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java:340)
    at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209)
    at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284)
    at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176)
    at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:107)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    |#]
    Dotun

    you will have to create a sequence and a trigger
    CREATE SEQUENCE <SEQUENCE NAME>
    INCREMENT BY  1
    START WITH  1
    NOCACHE
    /this sequence will guarantee that each requested number is unique
    the trigger will select from this sequence and insert the obtained value in the new record
    CREATE OR REPLACE TRIGGER <TRIGGER NAME>
    BEFORE INSERT ON <TABLE NAME>
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
        BEGIN
            select
                <SEQUENCE NAME>.nextval
            into
                :NEW.<COLUMN NAME>
            from
                dual;
        END;
    [/CODE]
    this will always take the value from the sequence, even if you already provided a value yourself
    (otherwise you will first have to test if :NEW.<column name> is null, but I wouldn't do this for a key column.
    if you need the generated key back for further processing (inserting it into a child table for example), you can use the returning clause on the insert statement
    see the oracle documentation for more information about sequences, triggers and the returning clause
    greetings
    Freek D
    I am new to Oracle and need to know how to create a table that uses an automatic incrementation on a primay key for it's default. I need the uniqueness automatically managed by the DBMS.. This activity is know as setting the Column (primary key with identity) in Ms-SQL..
    Your help would be appreciated greatly....
    Thanks....

  • How to speed up fast refresh of materialized view without primary key

    Thought I'd share this info, as I couldn't find anything on here to help me diagnose the issue:
    I had a materialized view that was taking longer to perform a fast refresh than it took to perform a complete refresh. My mview had no primary key, as the base table had no primary key.
    I created a trace file for the session and saw references to a column M_ROW$$ in my mview. Nowhere in the data dictionary could I find a reference to the m_row$$ column in my mview, but apparently it exists and is created automatically. After creating the index below, the fast refresh took 6 minutes to add 500k rows to the materialized view. (versus 4+ hours without the index) When I looked in the trace file, I noticed that for each row in the mview log, it first tries to update the mview with an UPDATE statement, then it performs an insert of the new data. Seems like it should be able to determine whether to perform an update or insert based on the DMLTYPE$$ column of the mview log. What was killing my performance was the UPDATE phase. Since I had no primary key on the mview, and no index on the m_row$$ column, the UPDATE phase was performing a full table scan of my mview for every row in the mview log. I was expecting it to be smart enough to only perform inserts, as the only transactions against the base table were inserts.
    In summary: If you have a materialized view without a primary key, create an index on the m_row$$ column of the mview, even though no such column displays in the data dictionary.
    ex:
    CREATE MATERIALIZED VIEW mv_minidrr ...
    CREATE INDEX pk_mv_minidrr ON mv_minidrr(m_row$$) ...

    Well, there indeed is a column called M_ROW$$
    Your MLOG$_EMP is nothing but the materialized view log on the base table.
    SQL> create  materialized view log on emp with rowid ;
    Materialized view log created.
    SQL> create materialized view emp_mview refresh fast on demand with rowid as select * from emp ;
    Materialized view created.
    SQL> desc mlog$_emp
    Name                                                  Null?    Type
    M_ROW$$                                                        VARCHAR2(255)
    SNAPTIME$$                                                     DATE
    DMLTYPE$$                                                      VARCHAR2(1)
    OLD_NEW$$                                                      VARCHAR2(1)
    CHANGE_VECTOR$$                                                RAW(255)
    SQL> select table_name, column_name from user_tab_columns where column_name = 'M_ROW$$' ;
    TABLE_NAME                     COLUMN_NAME
    MLOG$_EMP                      M_ROW$$
    1 row selected.
    SQL>

  • JBO-25014: Another user has changed the row with primary key oracle.jbo.Key

    Hi,
    I am developing a Fusion Web Application using Jdeveloper 11.1.2.1.0. I have a home.jspx page that has a ADF table built on efttBilling View Object. . When you click on one of the rows in the table, it will take you to detail.jspx where you can edit the row and save. When 'save' is clicked, stored procedures are executed to update/insert rows into few tables , and then go back to home.jspx where you need to see updated content for that row.
    To get down to the exact issue, updates are made to the tables on which the efttBilling View Object is built using a stored procedure. Once this is done, I am trying to requery view object to see new content. But I keep getting JBO-25014: Another user has changed the row with primary key oracle.jbo.Key error. Following are the approaches I followed to query new results:
    a. Executed Application Modules Commit Method. Created 'Commit' Action binding and tied it to homePageDef.xml. Called this binding from a view scope bean.
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
         OperationBinding operationBinding = bindings.getOperationBinding("Commit");
        Object result = operationBinding.execute();
       if (!operationBinding.getErrors().isEmpty())
        return null;
    b. Marked 'Refresh on Insert' , 'Refresh on Update', 'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    c. Tried to Requery View Object. Created a refreshViewObject method in Application Module Impl.java file, exposed this method to the client interface and created a invokeMethod Action binding in home.jspx
    Code in Application Module:
      public void refresheftTransactionsforBillingAccountViewObj1View()
        System.out.println("In eftTransactionsforBillingAccountViewObj1");
      findViewObject("eftTransactionsforBillingAccountViewObj1").executeQuery();
    Code in view scope bean
            DCBindingContainer bindings =
           (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operation =
            bindings.getOperationBinding("refresheftTransactionsforBillingAccountViewObj1View");
            operation.execute();
    I have searched web, ADF forums and tried methods suggested in there but no sucess.
    Could anyone please provide some insight in this issue. I have been battling with this since quite some time. I can provide you with the log file too.
    Thanks!
    Shai.

    What code does your Commit method have .. can you try using the Commit executable from the AM itself instead ?
    Also -
    Shai wrote:
    'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    which all attributes you set this property for . it should just be for History columns as such.
    Did you also check if this could be your scenario ?
    Decompiling ADF Binaries: Yet another reason for &quot;JBO-25014: Another user has changed the row with primary key orac…
    OR
    JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
    OR
    Another user has changed the row with primary key -Table changed externally
    Message was edited by: SudiptoDesmukh

  • 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

  • Comp. Primary key class-field mapping to DB columns problem.(EJB 2.0 CMP)

    Hi!
    I have deal with EJB 2.0 CMP bean.
    I have a composite PK so use the java class to store it. And there is a corresponding field in the Entity Bean with its primary key class type.
    The problem is: when deployment tool creates sql query for the findByPrimaryKey(PKClass ck)
    where ck is an object with 3 fielde : a_id, b_id, c_id.
    it says:
    <sql>SELECT "ck" FROM "MyTable" WHERE "ck" = ? </sql>
    And it means by the "ck" simple a column in DB but NOT the composite key which has to be splited into 3 different fields. So the container can't do the proper mapping.
    Does anyone know solutions?

    I was wrong about primary key class fields, take a look at Ejb2.0 Specification (10.8.2):
    The primary key class must be public, and must have a public constructor with no parameters.
    All fields in the primary key class must be declared as public.
    The names of the fields in the primary key class must be a subset of the names of the container-managed
    fields. (This allows the container to extract the primary key fields from an instance�s container-managed
    fields, and vice versa.)
    Right now I'm using BMP and I don't have this problems. Primary keys, calculated fields and types not supported by the DB can be easily achieved. But I understand your interest on CMP, is clearly evolving!

  • Error while creating the Unique Index of the Primary Key of an Item

    Hi all,
    I have deployed a new item (CO_CONTRACTUNIT_PRODUCT) in my publication. The deploy appears to be successfull as the item can be seen in the repository through the Mobile Manager.
    The problem occurs when i sync my local DB to get the item offline. While synchronizing, the following error appears, both in the sync window and the log file ol_sync.log.
    "ERROR",POL-5130,"11/09/2010 11:43:52","table or view %s.%s not found:CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID","DB_ROSHNI"
    However, the debug file gives this other error regarding this table.
    ALL_INDEX:CREATE UNIQUE INDEX "TPCO_CONTRACTUNIT_PRODUCT_PK" ON CO_CONTRACTUNIT_PRODUCT (CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID) -5130Error at C:\ADE\omeprod_ol103021\olite\db\build\win\ocapi\..\..\..\src\ocapi\allindexes.cpp line:329 rc:-5130
    Build date Mar 29 2010
    okErr=(table or view %s.%s not found)
    mess=(CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID)
    AddLog(-5130 "ERROR",POL-5130,"11/09/2010 11:43:52","table or view %s.%s not found:CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID","DB_ROSHNI")
    But the index that is being created and is giving the error is the index created automatically with the Primary Key of the table, and so nothing has been modified in that.
    The primary key of the table is created with the three columns that are part of the index that is returning the error.
    As I could not solve the error, I tried to drop and re-create the item in the repository, but no luck. As a last option, i tried to remove the item from the repository to be able to sync properly again (just like before creating the item), but the error still happens.
    Another weird point is that i have tried creating the item in another publication of another database (but with almost equal items), and the item could was downloaded to my local DB without any problem, which makes this problem still more bizarre.
    What can it be?
    Any help would be great!
    Roshni

    have you tried unistalling the client and reinstalling it?
    schema evolution changes are not always handled correctly please check thread:
    Modification of publication item into Mobile Server
    i quote from rekounas instructions:
    If you are just adding a field, you should only have to run the alter publication item API call.
    Here is an old note on schema evolution on different scenarios. The names for the APIs that they use are now deprecated. Use the ConsolidatorManager class and call the method alterPublicationItem("PUBLICATION_ITEM_NAME", "SELECT STMT") :
    A) Add column
    1. Upload all client data. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Change the Oracle8i/9i database schema (add column)
    4. Create a Java program to call the Consolidator Admin API AlterPublicationItem()
    5. Start Mobile Server
    6. Execute a sync from the client
    7. The new column should be seen on the client. Use MSQL to check snapshot definitions.
    B) Drop column
    1. Upload all client data. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Delete column of the base table in the Oracle database schema
    4. Create a Java program to call the Consolidator Admin API DropPublicationItem()
    5. Create a Java program to call the Consolidator Admin API CreatePublicationItem() and AddPublicationItem().
    6. Start Mobile Server
    7. Execute a sync from the client
    8. The new column should be seen on the cliet. Use MSQL to check snapshot definitions.
    C) Change column datatype
    Changing datatypes in a repliatated system is not an easy task. You have to follow certain procedures in order to make it to work. Use DropPublicationItem, CreatePublicationItem and AddPublicationItem methods from the Consolidator Admin API. You must stop/start Mobile Server listener to refresh the cache.
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop/create column (do not use conversion procudures) at the base table
    4. Call DropPublicationItem(). Check if the ErrorQueue and InQueue no longer exist.
    5. Call CreatePublicationItem() and AddPublicationItem(). Check if the ErrorQueue and InQueue reflect the new column datatype
    6. Start Mobile Server. This automatically resumes application
    7. Client executes sync. This should drop the old snapshot and recreate the new snapshot. Use MSQL to check
    snapshot definitions.
    D) Drop table
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop base table
    4. Call DropPublicationItem(). Check if the ErrorQueue and InQueue no longer exist.
    5. Start Mobile Server. This automatically resumes application
    6. Client executes sync. This should drop the old snapshot. Use MSQL to check snapshot definitions.
    E) Add table
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Add new base table
    4. Call CreatePublicationItem() and AddPublicationItem() method
    5. Start Mobile Server. This automatically resumes application
    6. Client executes sync. This should add the new snapshot. Use MSQL to check snapshot definitions.
    F) Changing Primary Keys
    Chaning PK is a severe operation which must be executed manually. A snapshot must be deleted and recreated to propagate the changes to the clients. This causes a full refresh on this snapshot.
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop the snapshot using DropPublicationItem() method o
    4. Alter the base table
    5. Call CreatePublicationItem()and AddPublicationItem() methods for the altered table
    6. Start Mobile Server. This automatically resumes application
    7. Client executes sync. The old snapshot will be replaced by the new snapstot using a full refresh. Use MSQL to check snapshot definitions.
    G) To Change a Table Weight =>
    Follow the procedure below to change the Table Weight parameter. The table weight is used by the Mobile Server/Synchronization to determin the sequence in which client records are applied to the Oracle database.
    1. Run MGP to apply any changes in the InQueue to the Oracle databse
    2. Change table weight using SetTemplateItemMetadata() method
    3. Add/change constraint on the the base table which reflects the change in table weight
    4. Synchronize
    gl m8

Maybe you are looking for

  • No Longer Syncing With iCal

    My appointments are no longer syncing between my iPhone & iCal. What's the first thing to try to get things back on track? (my syncing woes were already a nightmare, with none of my Macs syncronising over .Mac. Doh. What a pain.)

  • Help required in changing the default page during server startup

    I am using JSF 1.1 and BEA Workshop Studio 3.3 on WebLogic 9.2. When ever I start or restart my server, by default the application opens up in Internet Explorer with url http://localhost:7001/. I appreciate if someone can let me know if it is possibl

  • New LED Cinema Display calibration

    Will there be any hardware or software differences necessary between the calibration of the currrent LCD models and the new LED model?

  • IDVD 09 garbled output and kernel panic

    I upgraded a Mac Mini to 10.6.1 and tried iDVD for the first time. I created a project with slideshows from iPhoto, about 400 slides. Set the display time 5 seconds and a dissolve transition on each. No music. The burn took 4 HOURS, finished OK, ejec

  • Third party tool link for EDI 810

    Hi,   What is the third party tool for mapping EDI 810 and link. Thanks avi