How to intercept update on entity object using bc4j

Hi all,
I need to intercept a user from updating a particular entity object and create a new entity instead. I have a particular row in a database table that has a primary key with special meaning. If a user attempts to update this row, I want to automatically create a new row in the table with the information they entered and leave the original row unmodified. Any suggestions on how to do this at the entity layer?
Thanks
Mike

Hi Sung,
I've created 2 Entity Objects, named TestEo and OtherEo. The logic I've included is as follows: Before posting data for TestEo to the database (thus as part of the prepareForDML), I create a new instance of OtherEo, using the createBlankInstance method exposed on OtherEoDefImpl.
However, the instance thus created ends up in a STATUS_UNMODIFIED, regardless of locking mode (I've managed to eliminate the locking mode as an issue).
Could you give me an idea of where I'm going wrong? I've attached the prepareForDML() (with diagnostic msgs) and createBlankInstance() methods below.
TestEoImpl.prepareForDML()
protected void prepareForDML(int p0, TransactionEvent p1)
switch (this.getDBTransaction().getLockingMode())
case DBTransaction.LOCK_OPTIMISTIC:
System.out.println("Locking mode: LOCK_OPTIMISTIC");
break;
case DBTransaction.LOCK_PESSIMISTIC:
System.out.println("Locking mode: LOCK_PESSIMISTIC");
break;
// TODO: Override this oracle.jbo.server.EntityImpl method
super.prepareForDML(p0, p1);
OtherEoDefImpl otherEoDef = (OtherEoDefImpl) EntityDefImpl.findDefObject(
"testapp.OtherEo");
System.out.println("Entity Class: " + this.getClass().getName());
switch (this.getEntityState())
case EntityImpl.STATUS_DEAD:
System.out.println("Entity State: STATUS_DEAD");
break;
case EntityImpl.STATUS_DELETED:
System.out.println("Entity State: STATUS_DELETED");
break;
case EntityImpl.STATUS_INITIALIZED:
System.out.println("Entity State: STATUS_INITIALIZED");
break;
case EntityImpl.STATUS_MODIFIED:
System.out.println("Entity State: STATUS_MODIFIED");
break;
case EntityImpl.STATUS_NEW:
System.out.println("Entity State: STATUS_NEW");
break;
case EntityImpl.STATUS_UNMODIFIED:
System.out.println("Entity State: STATUS_UNMODIFIED");
break;
EntityImpl otherEo = otherEoDef.createBlankInstance(getDBTransaction());
System.out.println("Entity Class: " + otherEo.getClass().getName());
int state = otherEo.getEntityState();
switch (state)
case EntityImpl.STATUS_DEAD:
System.out.println("Entity State: STATUS_DEAD - " + state);
break;
case EntityImpl.STATUS_DELETED:
System.out.println("Entity State: STATUS_DELETED - " + state);
break;
case EntityImpl.STATUS_INITIALIZED:
System.out.println("Entity State: STATUS_INITIALIZED - " + state);
break;
case EntityImpl.STATUS_MODIFIED:
System.out.println("Entity State: STATUS_MODIFIED - " + state);
break;
case EntityImpl.STATUS_NEW:
System.out.println("Entity State: STATUS_NEW - " + state);
break;
case EntityImpl.STATUS_UNMODIFIED:
System.out.println("Entity State: STATUS_UNMODIFIED - " + state);
break;
OtherEoDefImpl.createBlankInstance()
public EntityImpl createBlankInstance(DBTransaction p0)
// TODO: Override this oracle.jbo.server.EntityDefImpl method
return super.createBlankInstance(p0);
Output - Test 1
Locking mode: LOCK_OPTIMISTIC
Entity Class: testapp.TestEoImpl
Entity State: STATUS_NEW
Entity Class: testapp.OtherEoImpl
Entity State: STATUS_UNMODIFIED - 1
Output - Test 2
Locking mode: LOCK_PESSIMISTIC
Entity Class: testapp.TestEoImpl
Entity State: STATUS_NEW
Entity Class: testapp.OtherEoImpl
Entity State: STATUS_UNMODIFIED - 1

Similar Messages

  • How can we create an entity object using multiple tables?

    Hi All,
    I'm a newbie to OAF.
    I'm trying to create a simple page using OAF.
    While creating Entity object, there is an option to add the database objects from which we can create our Entity Object.
    There we can enter only one database object.
    If suppose I need to create a Entity object by using mutiple data base objects, how can I add other database objects?
    Is there any option for multiple selection of database objects there?
    Thanks in Advance

    User,
    a). You should use the [url http://forums.oracle.com/forums/forum.jspa?forumID=210]OA Framework Forum for this question.
    b). Entity objects always correspond to a single table. I think you want to create a View object instead.
    c). Really, you want to be using the OA Framework forum.
    John

  • How / can I have jpg logo objects used on reports automatically updated

    How / can I have jpg logo objects used on reports automatically updated after making changes to the repository copy of the jpg logo object in the repository?   The reports are in the enterprise items folder of the repository and the logo.jpg file is in a subfolder of repository items.  I made changes but the changes seem to apply only after I set my options in crystal reports and open the actual rpt file itself. 
    Is there a way to have the changes to the logo show / apply in all reports that have the repository item logo inserted into it without having to open every rpt file in the repository?

    Yes, I understand that...  the problem I was having was that check box being unchecked whenever an unrelated change was made to rpt file...  I was able to ensure that it remained checked by doing save as to the rpt file and making sure the "enable repository refresh" box was checked and replacing the file when prompted upons saving the rpt file...

  • How to create Entity objects using xml as a datasource

    Hi All,
    How to create EO(ADF Business components) using XML as a datasource instead of database tables..Pls do reply..Its an urgent requirement
    Thanks in Advance
    Edited by: 1000899 on Apr 25, 2013 12:01 AM
    Edited by: 1000899 on Apr 25, 2013 12:02 AM

    There is nothing 'urgent' in this forum. We are all volunteers spending our spare time helping out other users. If you have an urgent matter, you have to open an SR with sopport.oracle.com
    If it's urgent, then why don't you provide information needed to answer the question.
    Which jdev version do you use?
    What is the use case?
    To answer your question: A look into the docs http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcadvvo.htm#sm0341 and http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcadvvo.htm#sm0338 holds the answer to it.
    Timo

  • How to manage lifespan of Entity Objects?

    Greetings,
    I am familiar with OA Framework, and I've already done several projects.
    However, I am going to start a project where Entity Objects will be needed, and I'm kinda confused.
    So I have a few questions:
    A) If I execute PL/SQL DML directly on the database, is there some auto-sync features that I need to use?
    ..or do I have to manually update the cache via Manual Cache Iteration / findPrimaryKey / etc ...
    B) Is it possible to to preserve cached EOs between pages?
    ..The docs say that re-executing a VO will "apply" the cached EOs, and I'm worried that unnecessary commits will happen.
    C) How are Entity Objects related to the OADbTransaction?
    If an Entity gets applied to its View Object, can I still "rollback" the changes at the Transaction level?
    Thanks in advanced for your wisdom !

    Hi,T Schneider
    Thank you for your appropriate advice.
    I reviewed the math textbook of my son immediately.
    PMReal newWidth = newLength * oldRect.Width() / oldLength;
    PMReal newHeight = newLength * oldRect.Height() / oldLength;
    It works perfectly.
    I just expected PMRect might have something pythagorean methods...
    I am a true idle man.
    Thanks.
    Satoru Fujimori

  • Problem to give default value in entity object using query

    hi,
    i have one entity object and i want to set default value of attribute like division which is based on employee code.
    entity object based on table leavedetail and using refrence table employee_hdr(empcode ,division).
    so how can i set default value of division attribute which is based on empcode attribute using SQL

    well,
    yes user, fetish nailed correctly.
    make some viewlink.
    something like says as example.
    department vo
    employee vo
    make viewlinks between those vo's
    important thing: exposed then source and destination accesor.
    use groovy :
    go to employee vo - create Department name field ( as transiest)
    use this statement default value expersion type.
    DepartmentView1.DepartmentName
    it will get the value. check over.
    so this example well suits to your scenario.
    i hope this will helps you.
    well create is an video. to get the value using groovy.
    http://www.youtube.com/watch?v=mpHV4x89a_A
    Edited by: ADF7 on Apr 14, 2012 5:46 AM

  • How to list an array of objects using struts in jsp and ActionForm

    I am using the struts ActionForm and need to know how to display an Array of objects. I am assuming it would look like this in the ActionForm:
    private AddRmvParts addRmv[];
    But I am not sure how the getter and setter in the ActionForm should look. Should it be a Collection or an Iterator?
    I am thinking I need to use an iterator in the jsp page to display it.
    I am also wondering if the AddRmvParts class I have can be the same class that gets populated by the retrieval of data from the database. This class has 10 fields that need to display on the jsp page in 1 row and then multiple rows of these 10 fields.
    Thanks.

    Most probably the easiest way to make it accessible in your page is as a collection.
    ie
    public Collection getAddRmvParts()
    You can use the <logic:iterate> or a <c:forEach>(JSTL) tag to loop through the collection
    As long as the individual items in the collection provide get/set methods you can access them with the dot syntax:
    Example using JSTL:
    <c:forEach var="addRmvPart" items="${addRmvParts}">
      <c:out value="${addRmvPart.id} ${addRmvPart.name} ${addRmvPart.description}"/>
    </c:forEach>

  • Add new entity object using JDBC Datasource.

    HI my jdev version is 11.1.1.5.0
    I have an adf application with JDBC Datasource connection.
    Now how can I Add a new entity object with JDBC Datasource.How can i connect to DB to map the entity object.
    Thanks

    You need to have a DB connection defined for the project to be able to create new EOs - so just define a new DB connection.
    If you already have ADF BC defined in your application - then it probably means you already have a DB connection defined - see project properties->ADF BC section.

  • How to auto update date column without using trigger

    Hi,
    How to write below MYSQL query in Oracle 10g :
    CREATE TABLE example_timestamp (
    Id number(10) NOT NULL PRIMARY KEY,
    Data VARCHAR(100),
         Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
    I need to auto update the Date_Time column without using trigger when ever i update a record.
    Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.
    mysql> INSERT INTO example_timestamp (data)
    VALUES ('The time of creation is:');
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The time of creation is: | 2012-06-28 12:37:22 |
    mysql> UPDATE example_timestamp
    SET data='The current timestamp is: '
    WHERE id=1;
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The current timestamp is: | 2012-06-28 12:38:55 |
    Regards,
    Yogesh.

    Is there no functionality in oracle to auto update date column without using trigger??
    I dont want to update the date column in UPDATE statement.
    The date column should automatically get updated when ever i execute an Update statement.

  • How do you track a moving object using Labview and Vision Assistant

    I am using Vision and Labview to create a program that tracks and follow a moving object using a high end camera. Basically what it does is it detects a foreign object and locks on to it and follows it where ever it goes in a control sized room.
    I have no idea how to do this. Please help. Or is there an available example.
    Thanks.

    Hello,
    It sounds like you want to look into a Vision technique called Pattern Matching.  Using our Vision tools, you can look for a image, called a template, within another image.  Vision will scan over the entire image of interest trying to see if there are any matches with the template.  It will return the number of matches and their coordinates within the image of interest.  You would take a picture of the object and use it as the template to search for.  Then, take a picture of the entire room and use pattern matching to determine at what coordinates that template is found in the picture.  Doing this multiple times, you can track the movement of the object as it moves throughout the room.  If you have a motion system that will have to move the camera for you, it will complicate matters very much, but would still be possible to do.  You would have to have a feedback loop that, depending on where the object is located, adjusts the angle of the camera appropriately.
    There are a number of different examples a that perform pattern matching.  There are three available in the example finder.  In LabVIEW, navigate to "Help » Find Examples".  On the "Browse" tab, browse according to "Directory Structure".  Navigate to "Vision » 2. Functions".  There are examples for "Pattern Matching", "Color Pattern Matching", and "Geometric Matching".  There are also dozens of pattern matching documents and example programs on our website.  From the homepage at www.ni.com, you can search in the top-right corner the entire site for the keywords, "pattern matching". 
    If you have Vision Assistant, you can use this to set up the pattern matching sequence.  When it is complete and customized to your liking, you can convert that into LabVIEW code by navigating to "Tools » Create LabVIEW VI..."  This is probably the easiest way to customize any type of vision application in general.
    I hope this helps you get started.  Take care and good luck!
    Regards,Aaron B.
    Applications Engineering
    National Instruments

  • "Software update failed", how can I update to ios8 without using itunes?

    I've received and error message, "software update failed".  How do I update my iphone 5s to ios8 without using itunes?

    Wait until later when the servers are quite so busy.

  • How to add CustomProperties to Excel object using BIPlatform service?

    Hallo,
    I got a Excel Info object using BIPlatform.Get method as follow
    ResponseHolder rh = mPlatformService.Get("path://InfoObjects/Root Folder/fileName/", null);
    Excel obj = (Excel)rh.InfoObjects.InfoObject[0];
    But how can I add Custom properties and them save them back in Server?

    Not available/supported in any of our SDK's.

  • How to get list of custom objects used in abap report program?

    Hi friends,
    I have a requirement in which I have to scan the entire abap report and retrieve list of custom objects used in it for example custom tables, data elements, structures, table types etc,. Is there any provision in SAP like fuction modules to do this functionality?  As of now I am coding everything manually where so many possibilities are there for all kinds of objects. Provide your answers and suggestions...
    Thanks,
    Nastera

    Hi,
    The best way to do this is environment analysis. Follow the steps:
    1. Open se38, type in the program name (don't click on on display/change or create button, stay on first screen only)
    2. Click on environment analysis button (hot key SHIFT+F4)
    3. It will throw a pop-up, which will ask for type of object you want to see, which are linked /used by this program. select all (or may be if you are only interested in Tables, then select table only)
    4. Hit 'Enter'
    You will get the full list of all objects used in this report program. Just note down the one which starts with Z or Y and that's it.
    Cheers,
    Anid

  • In Reply to : How to validate org.jdom.Document object using xsd: dvohra09

    Hi All
    I am creating org.jdom.Document object using constructor Document() and adding children using setRootElement(), setChildren() and addContent() methods. The children are objects of org.jdom.Element. If i want to validate the org.jdom.Document using xsd what i have to do. Thanks in anticipation.

    I tried the below code and it is always giving the
    Parsing fatal error : The markup in the document preceding the root element must be well-formed.
    But it is possible to validate the same Document object as right document after writing it onto xml file using XMLOutputter and parsing it using DOMParser
    Thanks in anticipation
    org.jdom.Document document;
    String documentString=document.toString();
    StringReader stringReader=new
    StringReader(documentString);
    SAXBuilder saxBuilder =new
    SAXBuilder("org.apache.xerces.parsers.SAXParser",true);
    saxBuilder.setFeature("http://xml.org/sax/features/vali
    ation",  true);
    saxBuilder.setFeature("http://apache.org/xml/features/v
    lidation/schema",  true);
    saxBuilder.setFeature("http://apache.org/xml/features/v
    lidation/schema-full-checking", true);
    //Set a error handler with
    setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
    saxBuilder.build(stringReader);

  • How to match filters to moving object using motion tracking ?

    Hi:)
    Excuse me for imperfect english.
    I'd like to perform the famous face wrao effect that I've seen in a tutorial for ADOBE AE.
    I've to match move a filter (like distortion-bulge) o a moving object using motion tracking, but i've nit able to perform it.
    (I want to distort an eye in a face that moves it)
    THanks

    Specialcase gives an excellent tutorial here:
    http://motionsmarts.com/tutorials/matchmove1/mm1.html
    Patrick

Maybe you are looking for

  • Unable to send or receive media messages. LG Lucid

    I got this phone in mid-April, however since getting it I have been unable to send and receive media messages. I am however able to send/receive media emails. I am using Chomp SMS for texting, as the default messaging application wasn't splicing long

  • CD stuck in slot, how to upgrade OS??

    I was wondering if I could use my iBook to install Tiger on my Graphite iMac. Another CD lives permanently in my drive. Any ideas? Flat panel G4   Mac OS X (10.2.x)   Graphite iMac, iBook

  • Routing operation deletion

    Dear All , we have auto GI & auto GR concept for production order confirmation . Now say one FG material have 10, 20, 30 , 40 operation . So here  the Auto Gi will happen at 10 operation & auto GR will happen at 40 th item . now if i have to delete 1

  • Increase swap space?

    Hey, Im using Solaris 10: -bash-3.00$ cat /etc/release                        Solaris 10 10/08 s10x_u6wos_07b X86 -bash-3.00$ uname -a SunOS arrow 5.10 Generic_137138-09 i86pc i386 i86pcI've install the system using ZFS as the root filesystem: bash-3

  • Css and images not working on 3rd party server

    Hello, I have read the previous posts on this subject, but found no resolution. I can confirm that the CSS and images were uploaded to Media Temple. The permissions are set to "read" I didn't change any of the file structures. uploaded as it was outp