About Automatic generation of Primary key

I have created one Z table. Its composite primary keys are vkorg
and Sales Representive Number. I have to assign Sales Representive number
through system. How it should be done?
Message was edited by:
        Nilesh Vakil

Nilesh , You asked the Same question in ABAP General
Please Refer the link.
Re: About Automatic Generation of Primary key
Regards
Rusidar S
Message was edited by:
        Rusidar Subramani

Similar Messages

  • EJB3: One-to-one relationships and auto-generation of primary key values...

    Dear Forum,
    I'm relatively new to JEE, and while I've so far enjoyed the convenience of EJB3 for most things, it seems that I have a corner case that can not be handled by the entity manager.
    First, here's a quick mockup of my entities:
        Gallery
                |
                -- [1] -------[1] ----> Author
                |
                -- [1] -------[M] ---> Photo
                                                  |
                                                  -- [1] ------ [1] -> PhotoImage
                                                                                     |
                                                                                     -- [1] ------ [1] -> IPTCData
                                                                                     |
                                                                                     -- [1] ------ [1] -> EXIFDataI also have a remote, stateless session bean that does nothing more than persist()/merge()/remove() and locate (through find() and a few custom queries) my Gallery and Photo instances.
    Now, the abridged version of my problem is this: when I persist a Photo, it naturally gets its primary key generated (I used @Id and @GeneratedValue). However, for some reason none of the other dependent entities inherit Photo's primary key value. In my client, I create a new Gallery locally and then persist it. I then create new Photo, PhotoImage, IPTCData and EXIFData instances. I add the IPTCData and EXIFData instances to PhotoImage (there are PhotoImage methods for adding those); then I add the PhotoImage instance to Photo (again, Photo has a setter for adding a PhotoImage). Then, I persist the Photo.
    --- Aside: ------------
    I've set up my relationships using annotations like @OneToMany (Gallery references a Collection of Photos), and @OneToOne (Photo's primary key references PhotoImage's primary key; PhotoImage's primary key references the primary keys of IPTCData and EXIFData). I've also added @JoinColumn annotations where necessary.
    Finally, I get the Gallery instance's Photo collection (public Collection<Photo> getPhotos()), I add the Photo to the collection, and I add the Photo collection BACK to the Gallery (public void setPhotos(Collection<Photo>)).
    At this point, the Gallery should have all of my entities contained inside of itself. However, when I persist the Gallery at this point, all of the entities show up in the database, but none of the primary keys get inherited. Photo's primary key gets generated automatically, of course, but the rest have zero (0) as their PK values. I had wanted, for example, IPTCData to get the value of Photo.id.
    I had assumed that the entity manager would persist everything for me provided that I told it, through my annotations, about which entities relate to which. Does persistence only work in the direction of retrieval? That is, does the entity manager only do its thing when fetching (versus setting) data when there is more than 1 object in the graph? I can't believe that it can't, otherwise we'd all be ditching it and going back to straight SQL to do our work.
    Thus, I HAVE to be doing something wrong, or else omitting to do something right.
    I've made other incarnations of the above setup, and none of them have worked perfectly. I've even set up foreign key constraints in the database, but I had my share of unresolvable problems there, too.
    So I guess my big question with all of this is: when you have a deeply nested graph of objects, can the entity manager figure everything out and persist all of the objects correctly and with the right values? If not, boo. If so, how does one accomplish this?
    I know that I could persist each and every entity separately in my client code, but I wanted to have a natural-looking way of piecing all of my entities together. More specifically, I could persist IPTCData explicitly; however, I want to be able to add everything to a Photo and only persist the Photo itself, with the idea that all of the objects and sub-objects would be persisted automagically.
    Is this possible? Or have I bought into a pipe dream with the guarantee of the proverbial magic bullet?
    Thanks to everyone in advance for his/her input.
    Regards,
    Michael

    Daniel,
    Late last night I found the solution to my problem. And you're right, it had everything to do with which side is wired to which. I got confused about which side to consider the "owning" side, since one can look at it from the perspective of the database or the application.
    Interestingly, the first 2 lines of your example code match my client code almost verbatim: First, I create a new Gallery (or else I get an existing one). I then create a new Photo and then add it to the Gallery's collection using add(). I then persist the Gallery. My session bean internally calls EntityManager.merge(gallery). How it differs from your example, though, is in the fact that, on an application level, a Photo has no knowledge whatsoever of a Gallery. Which is to say that my Photo class does not have a 'getGallery()' method. Somehow, Hibernate is able to figure it all out and still update Photo's 'parentIdRef' column in the database. My logs show that Hibernate issues a SQL UPDATE on the Photo after both a Gallery and a Photo have been created. It sets the Photo's 'parentIdRef' column to the primary key value of the owning Gallery.
    Getting back to the matter, my problem was not with being able to map a Photo to a Gallery; rather, I was unable to add a PhotoImage to a Photo and have the relationship get correctly mapped in the database. The relationship between a Photo and a Gallery is many-to-one: there can be many Photo objects inside of a Gallery. In the database, a Photo row contains a 'parentIdRef' column whose value is that of a Gallery's primary key. I used @OneToMany on the Gallery, since a Gallery is, from an application perspective, the "owning" side, even though it's only the Photo that knows who it's referring to since only IT contains the 'parentIdRef' column in the database.
    I tried setting up the relationship between a PhotoImage and a Photo in the same manner, with the PhotoImage having a 'parentIdRef' column and referring to a Photo's primary key. I had annotated the Photo's getPhotoImage() method with @OneToOne, along with an appropriate @JoinColumn.
    It was THIS part that I had backwards. With a @OneToMany relationship, the child refers back to the parent --- it can be no other way. However, with a @OneToOne relationship, the owner refers to the child.
    So, to make a long story short, all I had to do was create extra database columns for Photo. Those columns refer to the primary keys of PhotoImage, EXIFData and IPTCData. Concretely, for example, Photo.photoImageIdRef references PhotoImage.id. And so on and so forth.
    The only negative side-effect of this is that my database-level foreign key constraints are now broken, since Hibernate wants to persist PhotoImage, EXIFData and IPTCData before it persists Photo.
    I have to investigate more deeply the 'cascade=...' option of the @OneToOne annotation in order to find out it relates, if at all, to a database-level cascade.
    Anyway, thanks for the reply. It seems that you had a very good idea about what my problem was. I would have posted the fact that I had resolved the problem last night, except that it was too late and I was heading to bed. If you still want the Duke points, let me know. I don't currently know the rules about if, when and to whom I should issue points in cases like these when I've already solved the problem.
    Regards,
    Michael

  • Automatic Creation of primary key at the time of creating entries

    Hi All,
    I have a requirement to generate the primary key automatically at the time of creating entries. I have managed to do so by writing an event code for the maintainance object in SE54.
    However called only when I create entries throught the Maintainance View.
    It does not get called when I write an insert statement in the program.
    Please suggest a way to achieve this.
    Thanks in advance,
    Archana.

    for assigning the primary key while using insert statement, write a piece of code to get the last pk value, increment it by 1 and then assign this value to the pk field of the next record while inserting. if you are using a fn mod to insert values, just have this piece of code right before the insert query. a better way would be to use a GUID which will be unique globally. there is a fn mod GUID_CREATE which you can use to generate GUID. i don't think there is a way to automate this while making entries using se11, unless you change the code that actually creates the entry in the database.

  • Column prefix and automatic generation of surrogate key

    Hello,
    I used Oracle Designer and could always generate columns with prefixes and got surragate keys as Primary key. Now I cannot find these properties in data modeler.
    Thank you for your help
    Siegwin

    Hello Siegwin,
    Abbreviation (Abkurzung) is on the General (Allgemein) tab in the Properties Dialog for a Table in the Relational Model.
    There are 2 alternative ways to run the Transformation script:
    1.  Right_click on the Relational Model in the Browser, and select Apply Custom Transformation Scripts (Benutzerdefinierte Transformationsskripte anwenden) from the drop-down menu.
        Use the right arrow to move "Table abbreviation to column" from the left column into the right column.
        Select the Apply (Anwenden) button.
    Alternatively
    2.  From the Tools (Extras) menu select Design Rules/Transformations (Entwurfsregeln/Transformationen).
        Select the fourth entry ("Table abbreviation to column") and click the Apply (Anwenden) button.
        Then click the Close (Schliessen) button.
    Note that you can run Data Modeler in English if you wish.
    First close Data Modeler and then edit the file datamodeler.conf (if you are using Data Modeler in 32 bit mode) or datamodeler64.conf (if you are using Data Modeler in 64 bit mode).
    These files are in folder datamodeler\datamodeler\bin.
    To run Data Modeler in English, you should add the following lines to the file:
    AddVMOption -Duser.country=US
    AddVMOption -Duser.language=en
    Regards,
    David

  • How do u automatically generate a primary key using JDBC?

    ok, basically i'm given a simple schema
    with 5 fields, one of these are made as a constraint made for primary keys.
    I am programming under Oracle, using JDBC, and everytime i insert a new record into the table using an INSERT statement it says it cant make the id null, well yeah, then how exactly do i make it generate a new ID?
    Thanks guys.

    In the table schema, the cid field is a INTEGER
    type.
    Ok i must of accidentally typed an extra digit, it's
    working now hmmm but i'm starting from this digit now
    : 1000000016
    If i go more higher and it truncates again, is there
    anyway to fix that?No. You can however write your code to verify it.
    Noting of course that the problem will next occur after 1 billion records have been added. So I would question at what rate you think that that table is going to grow.
    Of course you could create your own id but that would require modifying the table.

  • Help Primary Key generation

    According to article "Generating Primary Key Values in CMP Beans" (http://www.netbeans.org/kb/41/generated-primary-keys.html) you can specifiy automatic primary key generation.
    The following fragment describes a key issue when you have a existing database schema.
    If the database schema is not created during deployment, the primary key column in the mapped table must be of type NUMERIC with a precision of 19 or more, and must not be mapped to any CMP field. The Sun Java System Application Server generates unique values for the primary key column at runtime.
    In the used sample for how to set up a MySql database the creation of the customer table must be as follows:
    CREATE TABLE customer (
    id BIGINT(19) NOT NULL auto_increment, -- this column will be automat. generated
    lastName varchar(25) NOT NULL,
    firstName varchar(30) default NULL,
    PRIMARY KEY (id));
    My question is:
    Is it nescesary to have the field id to be decleared auto incremented?
    The first fragment says that the AS will create new values for the primary key. Or does the generation of primary keys only work if the pk field in the database table is auto incremented by the database?
    Please help. Thanks!
    Johan.

    Hello Johan,
    no, as i remember it does not work if you specify the id column as auto_increment. The J2EE bean container does manage the generation of the primary key, so the database must have a column type int(19) or bigint and primary key, not more.
    Hope this helps, more information is in the J2EE documentation from Sun, page 1012.
    Kind regards,
    marc.

  • CMP with Primary key generation in Oracle

    I need to know how can I from my Entity Beans use Oracle sequences to automatically create my primary key.
    I know that Weblogic lets to define with sequence to use in the deployment descriptor, but the problem is that I am using Websphere Application Server.
    Does anyone have any suggestion doing this.
    Very Thanks!!

    See if this link helps - http://theserverside.com/patterns/thread.jsp?thread_id=220

  • 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

  • Source tables for forms and tabular forms must have a primary key.

    Why does HTML DB 2.0 return the message
    "Source tables for forms and tabular forms must have a primary key."
    when trying to generate a "Report and Form" page based on a view defined like "create view <applicationschema>.a as select * from <sourceschema>.b" ?
    It should be possible for HTML DB to "see" that the table "<sourceschema>.b" already has a primary key.
    bw - Christian

    Christian,
    In the create application wizard, when creating form or tabular form pages, you can only use tables with primary keys, and not views, because that wizard is automatically deriving the primary key from the table definition. If you want to build forms on views or tables without a primary key, you need to use one of the create form wizards while working on an existing application. Those wizards allow you to pick your own column as a primary key column.
    Regards,
    Marc

  • Automatic primary key generation for pointbase

    Hello friends,
    I was wondering whether it is possible to automatically generate primary keys for a pointbase database. Just like the SQL Server pointbase also has a indentity property. I have used weblogic builder to specify automatic key generation. Through the pointbase console I can see that all the columns for all the tables are marked as nullable except the primary key columns. However when I try to insert data into the database using ejb. I get the exception :
    javax.ejb.EJBException: EJB Exception:: java.sql.SQLException: Data exception -- null value not allowed. .
         at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
         at com.pointbase.net.netJDBCPrimitives.handlePrimitiveResponse(Unknown Source)
         at com.pointbase.net.netJDBCPreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:94)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.__WL_create(DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.java:3177)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.ejbPostCreate(DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.java:3094)
         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:324)
         at weblogic.ejb20.manager.DBManager.create(DBManager.java:1151)
         at weblogic.ejb20.manager.DBManager.localCreate(DBManager.java:1100)
         at weblogic.ejb20.internal.EntityEJBLocalHome.create(EntityEJBLocalHome.java:171)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1_LocalHomeImpl.create(DirectoryItem_lh4yf1_LocalHomeImpl.java:94)
         at yellowpages.web.controller.AddEntryAction.execute(Unknown Source)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    ; nested exception is: java.sql.SQLException: Data exception -- null value not allowed. .
    java.sql.SQLException: Data exception -- null value not allowed. .
         at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
         at com.pointbase.net.netJDBCPrimitives.handlePrimitiveResponse(Unknown Source)
         at com.pointbase.net.netJDBCPreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:94)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.__WL_create(DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.java:3177)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.ejbPostCreate(DirectoryItem_lh4yf1__WebLogic_CMP_RDBMS.java:3094)
         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:324)
         at weblogic.ejb20.manager.DBManager.create(DBManager.java:1151)
         at weblogic.ejb20.manager.DBManager.localCreate(DBManager.java:1100)
         at weblogic.ejb20.internal.EntityEJBLocalHome.create(EntityEJBLocalHome.java:171)
         at yellowpages.ejb.DirectoryItem.DirectoryItem_lh4yf1_LocalHomeImpl.create(DirectoryItem_lh4yf1_LocalHomeImpl.java:94)
         at yellowpages.web.controller.AddEntryAction.execute(Unknown Source)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    I am not sure whether I understand your question.
    The 'NamedSequenceTable' method is independent of data base type.
    <from-docs>
    Create a table named SEQUENCE to hold the current primary key value. The
    table consists of a single row with a single column, as defined by the
    following statement:
    CREATE table_name (SEQUENCE int)
    INSERT into table_name VALUES (0)
    </from-docs>
    Then, you can add the following in the DD -
    <automatic-key-generation>
    <generator-type>NamedSequenceTable</generator-type>
    <generator_name>table_name</generator-name>
    <key-cache-size>100</key-cache-size>
    </automatic-key-generation>
    The PK type should be set to java.lang.Integer or java.lang.Long
    --Sathish
    <Panduranga Swamy> wrote in message news:[email protected]..
    Hi,
    With named sequecne table,I am able to develop the application. What I
    wanted is Say Table 1 having Identity column as Primary key in the table
    Pointbase database.
    With Automatic primary key generation in Deployment descriptor, We
    generally specify SQL_SERVER or Named Sequencetable for Primary key
    generation.
    For pointbase database, I dont know how to configure this?
    Could you help me in this regard,
    Thanks,
    Pandu

  • Primary key generation: Using CounterHome?

    I can't find any documentation that talks about automatic primary key generation support on OC4J. I noticed the article on the Orion Support page that mentions their "Counter" bean. Is this the extent of support for automatic primary key generation in OC4J? When I searched for this class in the distribution, I only found it in a demo application in JDeveloper.
    Is this something that is handled directly in the Oracle DB, which is why OC4J doesn't bother to support it?

    Sorry I wasn't specific. By "going nowhere", I meant it went to an error page on the orion site. I don't know why it couldn't find it, because when I just now searched for the article with the title you just gave, the resulting URL was identical to what you gave me originally.
    As to the "counter faq", I think I've seen that before, but I can't get to it right now (server overloaded or something). The one problem I remember with trying to pursue the "counter" solution was somewhat simple. I couldn't find the code. I didn't notice a download for the "Counter" class, and I can't find it in either the jdeveloper or oc4j distributions.
    In any case, I ended up implementing the UUID solution, based on Floyd Marinescu's example in "EJB Design Patterns". I think this will work fine for our application.
    I'd still like to know more about Orion's "Counter" solution, if there's any real code available to see.

  • Primary key generation

    How do use primary keys generated by database within entity bean?

    DBMS primary key generation uses a set of deployment descriptors that
    are specified at compile time to generate container code which is used
    in conjunction with a supported database to provide key generation
    support. Specify the name of the supported DBMS and the generator name,
    if required by the database. Generated primary key support for Oracle
    databases use Oracle's SEQUENCE. Once the SEQUENCE already exists in the
    database, you specify automatic key generation in the XML deployment
    descriptors. In the weblogic-cmp-rdbms-jar.xml file
    <automatic-key-generation>
    <generator-type>ORACLE</generator-type>
    <generator_name>test_sequence</generator-name>
    <key-cache-size>10</key-cache-size>
    </automatic-key-generator>
    You need to specify the name of the ORACLE SEQUENCE to be used in the
    generator-name element. If the ORACLE SEQUENCE was created with an
    INCREMENT value, then you must specify a key-cache-size. This value must
    match the Oracle SEQUENCE INCREMENT value.
    Owen wrote:
    How do use primary keys generated by database within entity bean?

  • Marinescu Primary Key Generation

    Hi
    i'm using Marinescus Primary Key Generation schema, but i'm having a problem
    As i see it in EJB Design Patterns (Marinescus Book), he uses a Hashtable to store the values so that the Bean doesn't have to access the database everytime
    My problem is that this Hashtable is not working, because each client when access the Bean, this creates a new bean (just like in the pattern) and thus there is never info on the Hashtable, thus the application has to go to the Database.
    If i put the Hashtable as static, i will have Concurrency Problems
    But my real problem is that i've seen various implementations of this pattern, and no one seems to talk about this problem
    Am i missing something ?
    I've thought maybe Marinescus uses only one static SessionBean (resolving the problem), but he create one Bean for each request also
    Thanks

    So, i found the problem
    I had the SessionBean configured as a Stateful Session Bean
    But if i change it to Stateless it starts working
    I still didn't figured out why (as no Load, Store, Passivation or Activation code exists to keep or get the Hashtable)
    So if any one could explain it to me, it would be nice :)
    Thanks

  • Basic doubt about Primary Key/Foreign Key in Oracle Tables

    Hi,
    I have a doubt whether Primary Keys/Foreign Keys are allowed in Oracle. Some of the people I know are telling me that Oracle does not encourage having Primary Keys/Foreign keys in its database tables.
    However if I go to the ETRM and look for information about some of the Oracle Tables, I am informed that Primary Keys do exist. However I am being told that ETRM is not a reliable way of having correct information about table structure.
    It would be great if any one of you provides me with some insight in this. Any pointers to a document would be great.
    Thanks

    It is not that PK/FKs are disallowed in Oracle Apps (there are some on the standard Oracle Apps tables), but they are typically not used. I am not positive what the logic behind this is, but my guess is that it was party due to the earlier versions of Oracle Apps pre-dating declarative database referential integrity in Oracle DB and also on performance issues with the standard referential integrity with the earlier versions of declarative database referential integrity.
    As far as eTRM is concerned - I understood that the data is based on a design repository rather than a physical Oracle Apps DB. So all of the information in there is logically correct, but not necessarily enforced via the standard Oracle DB declarative referential integrity (rather by the application code or APIs).

  • Error in primary key generation

    Hello,
    I am using Postgresql database with jboss. I am using sequence block pattern for generating automatic primary key using source code provided by ejbdesignpattern book. but when i use transaction attribute of RequiresNew for method getValueAfterIncrementingBy I get following exception. excpetion disappear when transaction attribute is changed to Required but book recommends using RequiresNew attribute for the mehtod
    can sombody tell y this exception is being raised and workaround.
    15:57:23,507 WARN [TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=c40//
    1, BranchQual=] timed out. status=STATUS_ACTIVE
    15:57:23,707 WARN [TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=c40//
    2, BranchQual=] timed out. status=STATUS_ACTIVE
    15:57:23,707 WARN [BeanLock] wait() interrupted in txLock, possibly a timeout
    15:57:23,707 ERROR [BeanLock] Thread[RMI TCP Connection(2)-192.168.0.46,5,RMI Ru
    ntime]Saw rolled back tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=c40//2,
    BranchQual=] waiting for txLock
    15:57:23,707 WARN [TxCapsule] Lock contention, tx=XidImpl [FormatId=257, Global
    Id=c40//2, BranchQual=]
    15:57:23,727 ERROR [LogInterceptor] RuntimeException:
    java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedP
    essimisticEJBLock.java:339)
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(Queued
    PessimisticEJBLock.java:211)
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPe
    ssimisticEJBLock.java:159)
    at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
    tor.java:103)
    at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
    Interceptor.java:69)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:107)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:291)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:9
    8)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
    java:130)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
    at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLoca
    lContainerInvoker.java:301)
    at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
    at $Proxy34.getValueAfterIncrementingBy(Unknown Source)
    at com.gmi.mportal.SequenceSessionBean.getNextSequenceNumber(SequenceSes
    sionBean.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
    tatelessSessionContainer.java:660)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
    ke(CachedConnectionInterceptor.java:186)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
    elessSessionInstanceInterceptor.java:77)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:107)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:237)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:9
    8)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
    java:130)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContai
    ner.java:313)
    at org.jboss.ejb.Container.invoke(Container.java:738)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
    383)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    60)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:701)
    at java.lang.Thread.run(Thread.java:536)
    15:57:23,747 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedP
    essimisticEJBLock.java:339)
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(Queued
    PessimisticEJBLock.java:211)
    at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPe
    ssimisticEJBLock.java:159)
    at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
    tor.java:103)
    at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
    Interceptor.java:69)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:107)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:291)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:9
    8)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
    java:130)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
    at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLoca
    lContainerInvoker.java:301)
    at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
    at $Proxy34.getValueAfterIncrementingBy(Unknown Source)
    at com.gmi.mportal.SequenceSessionBean.getNextSequenceNumber(SequenceSes
    sionBean.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)

    I'm experiencing the exact same problem.
    I do have a piece of information to add, though.
    This problem only occurs when I run the code (generating a PK for a given table) the FIRST time. Once a row exists in the sequence table for a table, the code works.
    On the first run, the problem occurs after the row is inserted into the table. If the row already exists, you're all set.
    Still a problem, but at least you can work around it by prepopulating your sequence table.
    --- Matt

Maybe you are looking for

  • Best Practice - Outer Join between Fact and Dim table

    Hi Gurus, Need some advice on the below scenario I have an OOTB subject area and we have around 50-60 reports based on it. The related subject area Fact and Dim1 table are having inner join. Now I have a scenario for one report where outer join has t

  • Vox usb2.0 tv box compatibility

    Am thinking of buy a vox usb2.0 tv box. My PC only contains usb 1.1 interfaces. Does the usb2.0 tv box work properly with that interface or does it require usb2.0?

  • A new camera problem!

    Hello, So here is my problem... My isight camera is not being recognized, it says there is no camera connected to my computer when trying to use photo booth, skype, and ichat. Simple? Not quite. Read on! I have already unplugged my computer and all u

  • SAPRouter problem ERROR: sapserv2a: route permission denied

    Hello Gurus, we have a problem with connection with SAPOSS, when we test the connection present the following message: Connection Error Error when opening an RFC connection ERROR: sapserv2a: route permission denied (200.30.70.220 to oss001, sapmsOSS)

  • Contacts have not synced in blackberry bridge.

    How do I sync my contacts in blackberry bridge on my playbook? Everything else is fine.