Bc4j bug at refresh after insert / update

having a table and a trigger on it that fills an attribute
in a 9i db. one can take the scott/tiger emp table and use the
following trigger:
create or replace trigger t_bri_emp
before insert on emp
for each row
declare
v_no number(7,2);
begin
select user_SEQ.nextval*100
into v_no
     from dual;
:new.sal := v_no;
end;
then creating a bc4j project with an entity object based on this table (emp)
and a view object based on the created entity object.
!!!! when you create the bc4j project you must set the SQL Flavor to SQL92 or OLite
when you set the attribute settings, for the attribute the trigger is on (sal),
to refresh after insert / update or both in the entity object you get a
null pointer when you try to insert a new row and commit.
java.lang.NullPointerException
     oracle.jdbc.ttc7.TTIoac oracle.jdbc.ttc7.TTCAdapter.newTTCType(oracle.jdbc.dbaccess.DBType)
     oracle.jdbc.ttc7.NonPlsqlTTCColumn[] oracle ....................
all can be reproduced just useing the wizard and start the bc4j project with the tester
any workaround ??

Sven:
I looked into your issue. It turns out your problem is caused by a bug in the system (bug #2409955).
The bug is that for non-Oracle SQLBuilder, we are not processing refresh-on-insert and refresh-on-update attributes correctly. We end up forming an invalid SQL statement and the JDBC driver gives the obscure NullPointerException.
Thus, until 9.0.3, you should not use refresh-on-insert/update attributes on a non-Oracle SQLBuilder.
If you need the refresh-on-insert/update attribute, here is a possible workaround:
1. Whenever you invoke the tester, on the first panel, click on the 'Properities' tab. In the list of properties, you should find one for 'jbo.SQLBuilder'. It will say 'SQL92'. Remove it, so that it is empty. Run test tester. Then, the tester will use Oracle SQLBuilder which will handle refresh-on-insert/update attributes correctly for you.
2. For switching between Oracle SQLBuilder and SQL92 SQLBuilder, you can try the following:
2a) Locate bc4j.xcfg and your Project??.jpx under your 'src' directory.
2b) Make copies of these files.
2c) Edit them so that you have one set for Oracle SQLBuilder and one set for SQL92 SQLBuilder. For Oracle SQLBuilder, make sure these files do NOT have entries like:
<jbo.SQLBuilder>..</jbo.SQLBuilder> in bc4j.xcfg and
<Attr Name="_jbo.SQLBuilder" Value="..." /> in Project??.jpx
When there is no jbo.SQLBuilder entry, BC4J will default to Oracle.
For SQL92, make sure you have
<jbo.SQLBuilder>SQL92</jbo.SQLBuilder> in bc4j.xcfg and
<Attr Name="_jbo.SQLBuilder" Value="SQL92" /> in Project??.jpx.
Before you run, decide which SQLBuilder to use (for 9.0.2, with retrieve-on-insert/update attrs, you have no choice but to use Oracle SQLBuilder) and copy these files into your class path, e.g.,
<jdev-install-dir>\jdev\mywork\Workspace1\Project1\classes
When you get 9.0.3, then you should be able to switch between Oracle and SQL92 SQLBuilders freely.
Thanks.
Sung

Similar Messages

  • "Refresh after" insert fails for DB-View with INSTEAD OF Triggers

    Hi,
    I have a database view with INSTEAD OF triggers defined for INSERT, UPDATE, DELETE.
    For some EO attributes the refresh after insert and update is defined.
    Posting to database fails.
    According to Database 9.2 Manual and a previous thread (BC4J and Updatable Views the RETURNING clause is not allowed for database views with INSTEAD OF triggers.
    Is there a workaround so the refresh after is done, but without the RETURNING feature?
    I only need to refresh some values. The PK i can set in the create method of the EO so refresh via a additional SELECT would be possible.
    If not Feature Request:
    Add the possibility to do the "refresh after ..." with a 2nd SELECT using the PK instead of using the RETURNING clause.
    Of course then it is not possible to set the PK in the database trigger. PK has to be set in the create method of the EO.
    Thanks,
    Markus
    GEMS IT

    Hi Markus,
    Turning on the stack trace (-Djbo.debugout put=Console - in the Project/runner) did help and I should have done it sooner. Turns out that when I constructed my EO based upon a database view - I should have left out the PKs of the base tables.
    In my case, I am using an "Instead Of Trigger" to populate a multi-table arrangement (parent - child - grandChild - greatGrandChild relationship) where all base tables are using dbSequence/dbTriggers.
    Final analysis - I would like to see BC4J handle this situation. I do not want to use View-Links and I should * not * have to resort to stored procedures and BC4J/doDML. If I construct a DB View this is participating in an parent - child - grandChild - greatGrandChild relationship that are using dbSequence/dbTriggers, then BC4J should be smart enough to construct VO knowing that I want to do insert, update, delete, selects - based upon this structure.
    Thanks Markus,
    Bill G...

  • Adf - refresh after insert in microsoft sqlserver

    Hi!
    Its possible to use the entity option "refresh after insert" in a MSSql server database??
    I try to use this option and 1 error occurs
    "oracle.jbo.RowAlreadyDeletedException: JBO-25019:"
    Thanks in advance,
    Rui Pereira

    Thanks Steve,
    I use the latest version of jdeveloper - 10.1.2.0.0 (build 1811).
    The Sql Flaver selected is "SQLServer".
    Bellow are some line of ADF debugg:
    [85] BC4J Property jbo.SQLBuilder='SQLServer' -->(MetaObjectManager) from Client Environment
    [259] Warning: BaseSQLBuilder does not support RETURNING (key-cols) clause....
    [260] INSERT INTO ALERT.SYS_SESSION(SESSION_SA,IP,DT_IN,DT_OUT,ID_PROFESSIONAL) VALUES (?,?,?,?,?)
    [261] Fetch RefreshOnInsert attributes
    [262] BaseSQLBuilder.doRefreshSQL, Executing Select for Refresh-on-insert or update attributes
    [263] Built select: 'SELECT ID_SYS_SESSION FROM ALERT.SYS_SESSION'
    [264] Executing Refresh SQL...SELECT ID_SYS_SESSION FROM ALERT.SYS_SESSION WHERE ID_SYS_SESSION=?
    [265] General failure in select : JBO-25019: A linha da entidade da chave null não foi encontrada em SysSession.

  • ORA-01403: no data found  -  refresh after insert on view

    Hi all,
    I have problems with refresh after insert on view and i override this method on my xxDefImpl.java
    public boolean isUseReturningClause() {
    return false;
    Anyway what it does is to substitute the RETURNIN INTO to
    SELECT ID INTO ? FROM MY_VIEW WHERE ID=?; END;".
    And this gives me the error
    ORA-01403: no data found ORA-06512: at line 1
    Because i'm tryint to insert on my view with ID = -1
    And then the view and the my triggers make it happen to became a real ID.
    The thing is that i need to refresh my ID after insert and it runs this select with -1 and it finds no data of course because the trigger on the view and on my tables transformed it in a real ID .
    DO u know what's missing?

    See section 26.5 Basing an Entity Object on a Join View or Remote DBLink in the ADF Developer's Guide for Forms/4GL Developers for the additional tip I believe you're missing about marking a unique attribute as well.
    You can find the guide on the ADF Learning Center on OTN here:
    http://www.oracle.com/technology/products/adf/learnadf.html

  • Problem with a field set to refresh after insert at Row level

    hello all,
    i have a problem with a field (a serial) which is set by a db trigger at insertion. The field "refresh after insert" is properly set in the Entity and everything is refreshed correctly when i insert data via an adf form in a jspx but when i want to insert programmatically nothing is refreshed. I insert data this way :
    ViewObject insertVO = findViewObject("myView");
    Row newRow = insertVO.createRow();
    newRow.setAttribute("mandatoryAttribute1",value1);
    newRow.setAttribute("mandatoryAttribute2",value2);
    <more init here but not the serial since it will be set by the DB trigger>
    insertVO.insertRow(newRow);
    but when i want to get back the value with "newRow().getAttribute("TheSerial");" i always get a null back and not the value set by the db trigger.
    One way to get the serial is to commit after each insert but i don't want to commit between inserts.
    i've tried to unset the refresh after insert and override the createDef() method to setUseReturningClause(false) as it's is advised in chapter 26.5 of the ADF 4GL dev. guide but in this case i have an exception JBO-29000: JBO-26041.
    How can i get the value back properly ?
    thanks
    -regards

    The data for the newly created row doesn't get inserted into the database until the commit is executed, so the insert trigger isn't called.
    If you need to get the value without committing, then you should implement the trigger programmatically and drop the trigger from the database. The code below shows how you could do this.
    ViewObject insertVO = findViewObject("myView");
    Row newRow = insertVO.createRow();
    SequenceImpl seq = new SequenceImpl("MY_SEQ", insertVO.getDBTransaction());
    Long next = (Long)seq.getData();
    newRow.setAttribute("primaryAttribute", new Number(next));
    ...You will need to replace MY_SEQ and primaryAttribute with the correct values for your example, but this should acheive what you want.

  • Response.write after insert/update

    Hi
    Could anyone please show me how to do a response.write message on the page after insert/update?
    Wondering especially about the placement and the syntax of the response.
    DWCS5, Access, Asp
    Christian

    I'm sorry to say I don't know how to test values in ASP, have just started to use it.
    I didn't get it to work so I threw away the code and went for an ordinary text response on a second page.
    Might as well get a book and read up on it

  • (Automatic) Refresh of Cached object after insert/update

    Hi,
    (I am using Toplink 9.0.3 against an Oracle Database)
    I am inserting and updating records in the database through objects registered in a TopLink UnitOfWork. I happen to know that certain database columns will get a (changed) values because of Database triggers.
    Is it true that the only way to get these changed values reflected back to the TopLink cache is by explicitly executing a
    session.refreshObject();
    call for every object changed in the UnitOfWork?
    Is there no way to inform TopLink (for example through the descriptors for the relevant classes) that for certain classes after the insert/update an automatic synchronization with the database must be performed?
    I have not been able to find such a setting, but I may have overlooked it - I hope I did.
    Thanks for your help,
    Lucas Jellema (AMIS)

    In this case use a postMerge event -- it will get called after the merge of the cache and then you could update the object explicitly.
    Ultimately, the way to achieve the behavior you're looking for is events or refreshing.
    - Don

  • Refreshing the RowSetBrowser webbean after insert/update(?)

    How do I refresh the RowSetBrowser web bean after inserting or updating and committing a record thru the EditCurrentRecord web bean?
    I am unable to see the new record added in the RowSetBrowser unless I close the browser and re-enter.
    Any advice would be appreciated!
    null

    after you call to iniatialize() in the DWB, you can refresh the cache by calling
    <%
    dbw.getRowset().executeQuery();
    %>

  • Bug at "refresh after update "

    I have an EO, PK (CODPEDV,CODPROD), with two (CANT_APROB, CANT_PROG) attributes defined as "Refresh after Update" in
    the Attribute Settings of the EO, as they are being corrected by a Trigger on Update in the DB. all that is Ok;
    but, What if my update involves the PK of the EO (CODPEDV)?, here's the result:
    Error Message: JBO-26041: Failed to post data to database during "Update":
    SQL Statement "BEGIN UPDATE ITEM_PEDIDO_VENTA ItemPedidoVenta SET CODPEDV=:1 WHERE CODPEDV=:2 AND CODPROD=:3;
    SELECT CANT_APROB, CANT_PROG INTO :4, :5 FROM ITEM_PEDIDO_VENTA ItemPedidoVenta WHERE CODPEDV=:6 AND CODPROD=:7; END;".
    As i suppose, the FrameWork is trying to bring the values back for the Attributes updated from the DB of a Row that
    no longer exists (CODPEDV,CODPROD) , because was changed by the first sentence (CODPEDV). I'm Wrong??
    Alex.
    (I've already got a workaround for my case)
    null

    Yes, you're right. And it sounds like you already have a workaround.
    Blaise

  • Create trigger for after insert update

    i have table tt (id number (10), name varchar2(20), status varchar2(1) , stage varchar2(1))
    when i insert data in table tt
    id name status stage
    1 anil a
    then trigger fire and update same value of satge to status
    like
    1 anil a a
    pls give example

    Hi,
    please try this code:
    CREATE OR REPLACE TRIGGER <tiggername>
    AFTER INSERT OR UPDATE
    ON TT
    FOR EACH ROW
    DECLARE
    v_Status varchar2(10);
    BEGIN
    -- Insert record into audit table
    INSERT INTO orders_audit
    ( id,
    name,
    stage)
    VALUES
    ( :new.id,
    :new.name,
    :new.stage);
    select stage into v_status
    from tt where stage = new.stage
    update tt set status = v_status where id = new.id
    END;

  • ORA-29532 exception from after insert update trigger

    Trigger code:
    CREATE OR REPLACE TRIGGER SAMS.PERS_ALG_AIU_TRG
         AFTER INSERT OR UPDATE
              ON PERS_ALG
              FOR EACH ROW
    DECLARE
         trans_type          VARCHAR2(1);
         event_id          CONSTANT VARCHAR2(7) := 'A31_ZA1';
         data_src          CONSTANT VARCHAR2(15) := 'SI_A31_ZA1_VW';
         p_row_id          ROWID;
         select_stmt          VARCHAR2(5000);
         XMLString          CLOB;
    BEGIN
         IF INSERTING THEN
              trans_type := 'I';
         ELSE
              trans_type := 'U';
         END IF;
    SELECT ROWID
    INTO p_row_id
    FROM personnel
    WHERE pers_seq = :new.pers_seq;
    select_stmt := 'SELECT * FROM si_a31_ZA1_vw WHERE start_date = MAX(start_date) AND ROW_ID =chartorowid('''||p_row_id||''')';
         -- Produce the XML
    XMLString := si_lib.get_XML(select_stmt);
         -- Insert the transaction
         INSERT INTO si_transaction (transaction_type, event_id, status_id, timestamp, transaction_xml)
              VALUES ( trans_type, event_id, 'CR', SYSDATE, XMLString);
              EXCEPTION
                   WHEN OTHERS THEN
                   RAISE_APPLICATION_ERROR (-20040, sqlerrm);
    END;
    ... is causing ORA-29532 JAVA call terminated by uncaught java exception: java.lang.nullPointerException
    any ideas --- get_XML actually calls dbms_xmlquery.getXML

    When in doubt, break it into pieces and test the pieces. The following is not valid:
    SELECT * FROM si_a31_ZA1_vw WHERE start_date = MAX(start_date)
    Try replacing the above with:
    SELECT * FROM si_a31_ZA1_vw WHERE start_date = (SELECT MAX(start_date) FROM si_a31_ZA1_vw)

  • Refresh after insert records

    Hello,
    I am using the demo application for 4GL developers. In that after doing the insert and when I press the continue, it come back to the main service request page. However I cannot view the record I inserted. How can I solve this issue.
    Thanks

    Hi,
    make sure the view is refreshed. You can e.g crate an action binding in teh pagedef file that ponts to the ViewObject's "execute" operation
    Then, in the executables" section, create an invoke action pointing to this action binding. Set its refresh confition to #{!adfFacesContext.postback} so it only fires when returning from another page
    Frank

  • New keypress bug in N95 after v12 update + other b...

    Update v12 has rendered the whole phone practically useless. It misses keypresses - that is what is well known in this firmware, BUT the major pain in the **bleep** is that the end-call button doubles as a 9 on keypad and vice versa.
    I cannot press n.9 on keypad cause it automatically closes the application (like sms editor) when pressed.
    I can not dial numbers containing n. 9 , can not text messages etc...
    Thanks nokia for this fw - really!
    Did I mention that it also loses the microphone of my stannard handsfree (wired).
    It also boots about 3-6 times a day.
    Only thing that's improved an works (kinda cos' i can't type street names) is the gps.

    This is really starting to bug me!
    I tried to fix the odd behaviour via hard reset (green + 3 + *) the result being:
    Cannot restore backup from sdcard - all of my contacts, messages are gone 4 good!
    It just hangs up and reboots if i try to restore backup.
    This is just splendit!
    *bleeb* *bleeb* FFing *bleeb*

  • After insert & update trigger

    I need to write a trigger that if some columns of the master table have changed, the trigger will first insert the change to a copy table. Later on, if there are more changes to the master of the same row, it will compare the new value to the old value and delete the same row in the copy table and insert the latest change. I have wrote the following trigger. Some how when I run it, it has compilation error. Does anyone have any idea on how should I approach this?
    create or replace trigger TRITON.AFTER_INSERT_UPDATE_ITM001100after insert or update on TRITON.TTIITM001100for each rowdeclarev_reflag char(1);beginv_reflag:='0';if (:new.T$ITEM != :old.T$ITEM or :new.T$DSCA != :old.T$DSCA) then
    delete from ticcrm.ttiitm001100_copy;
    insert /*+append*/ into ticcrm.ttiitm001100_copy(T$ITEM, T$DSCA, T$DSCB, T$DSCC, T$DSCD, T$WGHT, T$SEAK, REFLAG)values(:new.T$ITEM, :new.T$DSCA, :new.T$DSCB, :new.T$DSCC, :new.T$DSCD, :new.T$WGHT, :new.T$SEAK, v_reflag);
    end if;
    end;
    /

    delete from ticcrm.ttiitm001100_copy;
    insert /*+append*/ into ticcrm.ttiitm001100_copy(T$ITEM, T$DSCA, T$DSCB, T$DSCC, T$DSCD, T$WGHT, T$SEAK, REFLAG)values(:new.T$ITEM, :new.T$DSCA, :new.T$DSCB, :new.T$DSCC, :new.T$DSCD, :new.T$WGHT, :new.T$SEAK, v_reflag);
    This is simple SQL statements, not PL/SQL.
    Use EXECUTE IMMEDIATE for executing it.
    P.S. Please do not forget to make good formatting of your code before posting it.

  • Yoga 8 (B6000) bug auto-rotation after launcher update

    Today I made the update of the lenovo launcher (by the way, I have th chinese version of the tablet), the auto-rotation doesn't work and it tells me at start-up that the apk (of the launcher I guess) is not compatible with my device...
    The rotation works once an app is launched but not directly from the launcher...
    Does anyone experience the same issue?

    I suppose you speek about the update available on http://launcher.lenovo.com/launcher/portal.php . The website is only in chinese, so I thing only chinese people can help you.
    What is the purpose of this update ?

Maybe you are looking for

  • ITunes has encountered a problem and needs to close. Sorry

    After upgrading to iTunes9.0 I can no longer use the application. Everytime I try to open it I get an error message that iTunes has encountered a problem and needs to close. I've deleted it and re-installed following all the troubleshooting steps in

  • 9 Beeps when starting up

    My Late 2008 MBP has a strange problem today: when pressing power button, it took a long time (about 5-8 seconds) to respond, and it beeps 9 times (3 short, 3 long , then 3 short) along with the white LED at the front of the machine blinks. After tha

  • Download to excel on grid generates url with Cross Site Scripting Attack

    When we try to download to exell on a grid (8.50.18). The webserver comes back with an automaticly generated url. This url now contains the characters "%0d%0a" (CR/LF Our firewall/ proyserver detects this string in the url as a Cross Site Scripting A

  • How can i give  points to others

    plz tell how can i give points to others

  • Photoshop Touch Crashing

    The app is repeatedly crashing when I try to add an image. Here's what I've done: Created a new blank project at 3450x3450 pixels on iPad 2 Tried to add a 22kb 3450x3450 pixels image. That's when the crash occurs. I have tried adding from Creative Cl