Define primary key in FormsGraph Bean

Hi !
I read that I need to declare a primary key for using MODIFY_ROW_DATA or REMOVE_DATA.
The problem is that there is 4 columns in the primary key of my table.
So, how can I declare this primary key in the FormsGraph Bean ?
Thanks for your help.
Sev

Hi,
because the BI Graph relational API doesn't support a 4th extra field for e.g. holding primary keys, the modify row data does a full object comparison, comparing - in your case the routine in localRelationalData.java compares the values of
xxx
v_week
v_quantity
with values found in the existing data object, which is held in memory. To be sure of what happens, please enable debugging on the Graph bean before performing the modification. The effect you see can have many reasons e.g. that the refresh of the screen doesn't work or that the implementation itself has a problem. The debug messages that get written to the JInitiator shows if there is a match found for the data you provided (message starts with "ModifyData(): ") . Also the output starting with "parseStringData()" is interesting.
Note that the Java source code is shipped with the demos - just in case you want to have a look yourself
Frank

Similar Messages

  • Compund primary key in entity bean

    hi,
    can somebody please explain how to use the compound primary key in entity beans? i have got a database table, the key of which consists of three fields, which I assign as PK when setting up the entity bean. In turn I get a compoundPK class, but without get/set-methods - is it necessary to write own get/set-methods within this class?
    In the bean class itself I get a compundPK-create() method - but what is the use of it? actually, in my findByPK-method I need the PK already.
    Hints appreciated - btw, help.sap.com is not very helpful in this case...
    regards, matthias

    WebLogic Server supports mapping a cmr field to the primary key.

  • OBIEE 11g: Fact table does not have  a properly defined primary key

    Hi,
    We have two fact tables and two dimension tables.
    We have joined the tables like
    D1-->F1
    D2-->F2
    D1-->D2
    We dont have any hieracies.
    It is throwing error in consistency check,
    [nQSError: 15001] Could not load navigation space for subject area ABC.
    [nQSError: 15033] Logical table Fact1 does not have a properly defined primary key.
    It is not like STAR Schema, its like snowflake schema. How to define primary key for fact table.
    Thanks.

    Hi,
    My suggestion would be bring both the facts to the same logical table sources and have a single fact table in the BMM layer joined with multiple dimensions.
    Build a dimension hierarchy for the dimensions and then in the content logical layer mapping, map the dimensions to the fact tables with detailed level/Total
    Refer the below link-
    http://108obiee.blogspot.com/2009/08/joining-two-fact-tables-with-different.html
    Hope this help's
    Thanks,
    Satya

  • Defining Primary Keys

    How do you define Primary Key with multiple columns (say two) where the values of the first column such as extract date is not unique and the values of the second column such as sequence number is unique. The combined value of the two columns will be unique. For example
    Extract Date Seq Number
    20070701 001
    20070702 002
    20070703 003
    If you can please send my the syntax of the table definition.
    Thanks.

    Should I define the Primary Key clause at the column level definition or at the table level definition.
    Column Level Definition:
    EXTRACT_DATE CHAR(8) PRIMARY KEY
    SEQUENCE_NUMBER CHAR (5) PRIMARY KEY
    This may define the two columns as UNIQUE. If I define without PRIMARY KEY clause and SEQUENCE_NUMBER with UNIQUE constraint. Later as you suggested using the ALTER Table statement to define the Primary key.

  • Primary key in Entity beans

    Hi
    If my database doesn't have primary key, then how can I define ejbFindByPrimarykey
    method in Entity Beans. ? or in that case can't I use Entity beans. ?
    Pls clear my doubt.
    Thanks in advance

    Ashish,
    If my database doesn't have primary key, then how can I defineejbFindByPrimarykey
    method in Entity Beans. ? or in that case can't I use Entity beans. ?An entity bean instance needs to be uniquely identifiable. That doesn't
    necessarily mean that you have a PK in the database, but those two things do
    usually go together.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "Ashish Mangla" <[email protected]> wrote in message
    news:3cf5b304$[email protected]..
    >

  • Primary keys in entity beans

    I am creating an assignment for an EJB class that I am teaching. The assignment will ask students to create an entity bean to represent messages posted to an internet bulletin board. The fields in the entity bean are ID number, topic, user name, date, and the message. This bean will use container-managed persistence.
    The ID number of each message will be used for the primary key.
    The client will present the user with a simple menu (at the DOS prompt) with options to list all messages, search for messages, add messages, etc.
    When a new message is added, I don't want the user to have to enter a unique ID - it should be generated in the code somewhere.
    What I'm looking for is the absolute simplest way to get an ID for each new message. (I'm planning a series of assignments, each getting more complex, and this is the simplest one).
    I was thinking of having the client get a list of all the messages, make a list of all the IDs used, find the largest ID, and add 1.
    Can anyone suggest any other techniques? Thanks!
    -J

    Two approaches:
    you could initialize the db with one row and use some (any) number as the primary key
    then when adding a new row, access the last row in the db to get it's primary key and add 1 to it.
    You could also use date+time as a string, and assuming no one adds messages at the exact date+time, then it will work.
    To work around the problem of having two messages with identical date+time (assuming lots of messages coming through), you can catch the DB exception and resubmit the entry with an updated date+time. With very heavy traffic this will eventually fail. But for what you are doing it should work fine.
    Finally, you should not run into the identical problem unless you are using asynchronous message beans. I doubt you are, so the EJB container will handle it I suspect.

  • Retrieving auto inc primary key from entity bean (MySQL DB)

    Hello,
    I searched the forum intensively, but did not find an answer for the following problem.
    I've set up an MySQL database "Location" with two fields (ID, Description), ID is my primary key and I've added the AUTO_INCREMENT flag to this field. This works fine, i can add a row in the table with my entity bean "Location" from my session bean :
    Location l = new Location();
    l.setDescription("at home");
    em.persist(l);
    and even when I ask this location back from the DB, there is no problem :
    Location l = em.find(Location.class,1);
    return l.getDescription();
    The rows in the table increment nicely. The problem however is, that you don't allways know the ID. So I would like to do the following from my session bean:
    Location l = new Location();
    l.setDescription("at home");
    em.persist(l);
    int id = l.getId();
    the getID method allways returns a null object. The row is added in the DB, but the auto incremented ID is not returned to the entity bean!
    I know I could solve this by generating the ID's myself, but one of the strengths of autoincrement should be not to have to do this, no?
    If anyone has a clue how to solve this issue, I would very much appreciate it !
    Michiel
    Edited by: Michiel82 on Dec 6, 2007 6:01 AM

    No reactions so far ... this is a work-around for the issue :
    I've created an additional table sequence with two fields: gen_key and gen_value. Then, in my Location entity bean I can add the following:
    @TableGenerator(
    name="locationGen",
    table="sequence",
    pkColumnName="gen_key",
    valueColumnName="gen_value",
    pkColumnValue="location",
    allocationSize=1
    @Id
    @GeneratedValue(strategy=GenerationType.TABLE,generator="locationGen")
    @Column(name = "id", nullable=false)
    private Short id;
    This generates the primary key in the bussiness logic, but I would like to get the autogenerated key from my MySQL database (see previous post). Is this perhaps not supported by EJB3.0?
    Michiel

  • Using CMR field as Primary Key in Entity Bean

    Hi, all!
    Can somebody tell me, is it possible to use CMR field as Primary Key field in Entity Bean?
    Thanks

    WebLogic Server supports mapping a cmr field to the primary key.

  • Using Composite keys in Entity Beans

    Hi, I am trying to develop a test application with two entity beans, (1) OrderBean (key is a string called order_no) and (2) LineBean (key is order_no and an integer line_no) using CMP 2.0. Relationship between OrderBean to LineBean is 1 to many. I created a primary key class for LineBean called, LinePK with both order_no and line_no as the public members. My home interface for LineBean has the following three finder methods:
    public java.lang.Object findByPrimaryKey(LinePK lkey);
    public Collection findByOrder(String order_no);
    public Collection findByProduct(String product_id);
    I could provide sql for the OrderBean which has only one field(order_no) as primary key, but I don't know how to code appropriate SQL for the finder methods of LineBean involving a user defined primary key class (in my case LinePK with order_no and line_no). I am trying to deploy this application in J2EE RI server, but getting deployment errors saying invalid return types for the finder methods. In the deploytool I provided the primary key class for LineBean as java.lang.Object with no primary key field name. Any help in this matter with sample sql code is greatly appreciated. Thanks !!!

    Some things to consider:
    - Your findByPrimaryKey in the Remote interface needs to have the remote interface as return type
    - The implementation of the finder needs to have your primary key class as return type
    - If you're using CMP 2.0, you need to specify the search criteria as EJB QL
    Using CMP 2.0, you don't code findByPrimaryKey at all, all you need is the EJB QL for findByOrder/findByProduct in the deployment descriptor. The EJB QL for findByOrder would look like:
    select Object o from Line where o.order_no = ?1If you use BMP, you would code the findByPrimaryKey implementation like this:
    public LinePK ejbFindByPrimaryKey(LinePK pk) throws FinderException {
      String sql = "select order_no from line_table where line_no=? and order_no=?";
      InitialContext ic = new InitialContext();
      Object obj = ic.lookup("datasourcename");
      DataSource ds = (DataSource)PortableRemoteObject.narrow(obj, DataSource.class);
      Connection conn = ds.getConnection();
      try {
        PreparedStatement stmt = conn.prepareStatement(sql);
        try {
          stmt.setInteger(1, pk.line_no);
          stmt.setInteger(2, pk.order_no);
          ResultSet rs = stmt.executeQuery();
          if (!rs.next())
            throw new ObjectNotFoundException("not found: " + order_no + "." + line_no);
          return pk;
        finally {
          stmt.close();
      finally {
        conn.close();

  • Primary keys in CMP

    Hello,
    I have 2 CMP having master and detailed relationship.
    1) BookingMasterBean
    2) BookingDetailsBean
    (having one to many relationship).
    This is to do with a new booking to be made for Squash halls in our application.
    The primary key in Master bean , as well as the details bean get generated by a triggers (on insert) in the database(oracle).
    I have a stateful session bean which handles the booking process( creating entities in both master and details). After create a master entity the key should of the master record should be used as one of CMP field value in the details bean.
    i.e., I need to retreive the generated key once ejbCreate has been executed and should be sent back to the Stateful session bean.
    Can anybody tell me how to do this?

    Whatever you have understood is exactly correct. I am passing a value object as a parameter in the ejbCreate method. The code looks as folows.
    CMP header bean:
    public Integer ejbCreate(BookingHeaderValueObject bookingHeader)
    throws CreateException
    setBookingId(new Integer(bookingHeader.getBookingId()));
    setBookingDate(bookingHeader.getBookingDate());
    setBookingSlot(bookingHeader.getBookingSlot());
    setMemberId(bookingHeader.getMemberId());
    setClubId(bookingHeader.getClubId());
    setHallNumber(bookingHeader.getHallNumber());
    setAccompaniedBy(bookingHeader.getAccompaniedBy());
    setAccompaniedType(bookingHeader.getAccompaniedType());
    setTotalCharges(bookingHeader.getTotalCharges());
    setBookingStatus('B');
    setArrivalStatus('N');
    setDateModified(new Date());
    return getBookingId();
    Session Bean code:
    public void bookSquashHall(BookingHeaderValueObject bookingHeader,
    ArrayList bookingDetails )
    throws RemoteException,
    CreateException, NamingException
    int bookingSerialNo = 0;
    BookingHeaderHome bookingHeaderHome = (BookingHeaderHome)
    getEntityHome("BookingHeaderBean");
    BookingDetailsHome bookingDetailsHome = (BookingDetailsHome)
    getEntityHome("BookingDetailsBean");
    BookingHeader bookingHeaderRemote = bookingHeaderHome.create(bookingHeader);
    if( bookingHeaderRemote != null)
    for( int index = 0 ; index < bookingDetails.size(); index++)
    BookingDetailsValueObject bookingDetailsObj = (BookingDetailsValueObject)
    bookingDetails.get(index);
    bookingDetailsObj.setBookingSlNo(bookingSerialNo+1);
    bookingDetailsObj.setBookingId(bookingHeaderRemote.getBookingId().intValue());
    BookingDetails bookingDetailsRemote = bookingDetailsHome.create(
    bookingDetailsObj);
    bookingSerialNo = bookingDetailsRemote.getBookingSlNo().intValue();
    The following are scripts used to create the table structures :
    create table booking_header (
    bh_bookingid number,
    bh_booking_date date not null,
    bh_booking_slot varchar2(11) not null,
    bh__memberid number not null,
    bh__clubid number not null,
    bh_hallno varchar2(7) not null,
    bh_accompanied_by varchar2(60),
    bh_accompanied_type varchar2(10),
    bh_totalcharges number(10,2) not null,
    bh_status char(1) not null,
    bh_arrived char(1) not null,
    bh_date_modified date not null,
    constraint booking_header_pk primary key(bh_bookingid),
    constraint booking_header_fk1 foreign key(bh__clubid) references club_details(cd_clubid),
    constraint booking_header_fk2 foreign key(bh__memberid) references member_details(md_memberid)
    create trigger booking_header_insert
    before insert on BOOKING_HEADER
    for each row
    declare
    newBookingId number;
    begin
    select nvl(max(BH_BOOKINGID)+1, 1) into newBookingId from BOOKING_HEADER;
    :new.BH_BOOKINGID := newBookingId;
    end;
    create table booking_details (
    bd_slno number,
    bd__bookingid number not null,
    bd_booking_date date not null,
    bd_booking_slot varchar2(11) not null,
    bd__memberid number not null,
    bd__clubid number not null,
    bd_hallfacility char(1) not null,
    bd__facilityid number,
    bd_charges number(10,2) not null,
    bd_status char(1) not null,
    bd_arrived char(1) not null,
    bd_date_modified date not null,
    constraint booking_details_pk primary key(bd_slno),
    constraint booking_details_fk1 foreign key(bd__bookingid) references booking_header(bh_bookingid),
    constraint booking_details_fk2 foreign key(bd__clubid) references club_details(cd_clubid),
    constraint booking_details_fk3 foreign key(bd__memberid) references member_details(md_memberid)
    create trigger booking_details_insert
    before insert on BOOKING_DETAILS
    for each row
    declare
    newSlNo number;
    begin
    select nvl(max(BD_SLNO)+1, 1) into newSlNo from BOOKING_DETAILS;
    :new.BD_SLNO := newSlNo;
    end;
    Should I be defining the ejb relationships in this case.?
    Also I saw in a search from google that we can implement ejbPostCreate to retrieve the primary key if generated by the container. Could I do something like that in order to get back the primary key.
    Is there any better approach for this. I am fairly new to the subject .

  • Creating a view with a primary key

    I want to create a view with a defined primary key. I understand
    the view is created within a select statement, but do not
    understand how you would define a particular field as a primary
    key in the view. Also if your select statement attempts to build
    the view and has duplicate keys in the select result set, what
    would happen when the duplicate key is found? Would it just not
    include the duplicate key in the view?
    Thanks in advance for your help.
    -Pat

    I have a rather difficult problem with duplicate invoice numbers
    contained in unique records. In other words I have many records
    that appear as follows:
    3593, 0004009090, CUSTOMER, TAX, 20000117,014011976-01
    4411, 0004009090, CUSTOMER, TAX, 20000718,014011976-01
    The last field is invoice number '014011976-01' In my case I am
    building a flat file using UTL_FILE for loading into SAP
    Business Warehouse. In SAP I need to have Invoice number as a
    key in which case I can't have duplicate invoice numbers. All
    the SQL I have tried to date returns a large amount of records
    similar to the above records. I am selecting these records from
    4 different schemas which represent 4 different companies. I
    realize the data is the problem and that the vendor of the
    product I am working with should not allow records with
    duplicate invoice numbers, but I have to get the data loaded as
    that is what they want and are paying for. So back to my View. I
    was hoping to create a view and be able to work in the view to
    remove duplicate records prior to writing them to a file. Any
    suggestions are welcomed.
    Thanks
    -Pat

  • Primary key in BM&M layer

    Hi all,
    I'm using OBIEE 11g. I have a simple question - what's the point and meaning of the primary key for a dimension table in the BM&M layer? What is the purpose of it? I tried to change it whit different columns but no different effect. For hierarchical tables - i think there is a big difference, but in non- hierarchical?
    Thanks in advance,
    Alexander.

    Hi Srini,
    Thanks for quick reply.
    A logical level may have more than one level key. When that is the case, specify the key that is the primary key of that level. All dimension sources which have an aggregate content at a specified level need to contain the column that is the primary key of that level. Each logical level should have one level key that will be displayed when an Answers or Intelligence Dashboard user clicks to drill down. This may or may not be the primary key of the level. To set the level key to display, select the Use for drill down check box on the Level Key dialog box.What about the dimensions which doesn't have hierarchical structure - they aren't level-based or parent-child hierarchies? If i use them to just filter by them the fact tables?
    If i check the consistency i will receive an error that the dimension has to have a properly defined primary key.
    Thanks in advance,
    Alexander.

  • About Primary key

    We declare primary key in our table..but why do we use Constraint with primary key? and what is the meaning of constraint in oracle

    Hi,
    Constraints is some kind of rule and those rule have different category, which is define as Key.
    Like.
    If you r define Primary key that time rule would be different and for other like unique, not null rule would be different.
    So we can characterize the constraint with different role and definition.
    Regs,
    Brij

  • Composite primary key and performance

    Hi
    I have a table with 110 columns.And PK for that table is a combination of 7 keys .
    We need to schedule a daily job which will insert/update the table .Daily on a average( estimate) we have around 100000 insertion and same number of updates on the table .
    So
    is it a good option to keep the 7 keys as composite PK ?
    Will it Effect the performance during DML operation on table ?
    Is there any alternative to this problem ?
    thanks in advance for your help

    You define primary key as per business requirements. Its upto you to decide that you need 7 columns primary or not.
    However, 100000 records a day wont be a big problem, unless if you are inserting them as bulk.
    Jaffar

  • Composite Primary Key in M:N CMP Entity Bean Relationship

    Dear Sir/Madam,
         We are creating an Enterprise Application for our institute using EJB 2.0 specifiactions. In the course of developement, we are facing a problem in writing the CMP Entity Beans with EJB Relationships.
         We are having many to many relationship between two beans such that the primary key of one Entity Bean (let's call it A), serves as the foreign key of another Entity Bean (let's call it B). Further, this primary key of A as foreign key in B, participates in the composite key of B.
         The EJB Specifications require that the primary key field(s) of any bean (B, in our case) declared in the Primary Key class should be the subset of the 'cmp-field' declared in the deployment descriptor for that bean. As I said earlier, we have many to many relationship at play. Hence, we require to keep the foerign key in the 'cmr-field' in lieu of 'cmp-field'. In short, the component of primary key is in 'cmr-field' while, it is needed in both 'cmp-field' and 'cmr-field'. That's perfect from Database point of view but illogical from CMP Entity Bean's view.
         How can we write the deployment descriptor for such a CMP (BMP is working fine for above scenario) Entity Bean? Also, how can we write the Primary Key class? The problem is not just to find the solution, but find under the hood of EJB 2.0 specifications.
         Please help.

    I think you should realise that it would not be convenient to use CMP for everything. It is difficult to define complex relations using CMP. Mostly BMP os preferd since it gives the flexibility for the bean developer.
    Regards
    xH4x0r

Maybe you are looking for