Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:14:25 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

September 2004
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Aug   Oct

Get Firefox!

Saturday, September 18, 2004

I've had a couple of different people ask in the last week about ADF-related issues that both boiled down to Bug 3267441, which reports that doing a findByPrimaryKey() on a parent entity object definition -- like Person -- doesn't find an entity instance if it happens to be of a subtype of that entity -- like Doctor extends Person. The following code illustrates the easy workaround in case you need to have this functionality in your ADF application. It's also part of the quick-and-dirty PolymorphicVORows example I built yesterday for a customer who was asking for one that showed off all of our polymorphism features in ADF Business Components. As illustrated in the example, to make use of a customized Entity Definition class implementation, just provide your class name instead of the default one for the "Definition Class" which you can set by clicking on the (Class Extends...) button on the "Java" panel of the Entity Object editor. Like the other quick-and-dirty examples, when I get a chance I'll be turning them into more well-documented OTN HowTo's in the future.

package example.fwkext;
import com.sun.java.util.collections.Iterator;
import com.sun.java.util.collections.List;
import oracle.jbo.Key;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.EntityDefImpl;
import oracle.jbo.server.EntityImpl;
public class CustomEntityDefImpl extends EntityDefImpl  {
  /**
   * Workaround for Bug 3267441:
   * FindByPrimaryKey On Parent Entity Doesn't Find Extended Child EO Instance
   * -------------------
   * Overridden framework method to search in the entity caches
   * of subtyped entity defs if the findByPrimaryKey() returns
   * null for the current entity def.
   * @param txn DBTransaction to use
   * @param key Key of the entity instance being looked-up
   * @return Entity instance if found, or null of not found.
   */
  public EntityImpl findByPrimaryKey(DBTransaction txn, Key key) {
    EntityImpl e = super.findByPrimaryKey(txn, key);
    if (e == null) {
      List extendedDefs = getExtendedDefObjects();
      if (extendedDefs != null) {
        Iterator iter = extendedDefs.iterator();
        while (iter.hasNext()) {
          e = ((EntityDefImpl)iter.next()).findByPrimaryKey(txn,key);
          if (e != null) {
            break;
          }
        }
      }
    }
    return e;
  }
}

12:19:43 PM    



Yesterday I mailed Robert Scoble at Microsoft hoping he could shed some light on the confusion I had about using Virtual PC 2004 together with Windows XP SP2:

Robert,

Hey. I've been wanting to move up to Windows XP SP2 but the information at http://support.microsoft.com/?id=884130 which lists Virtual PC 2004 as one of the products that is known to "run slowly" under XP SP2 has scared me away. Like I'd imagine many of your developers and testers do, I'm using Virtual PC for similar reasons in development at Oracle to test various configurations of our products on different OS configurations. Are you aware of any pending remedy to this issue with Virtual PC and Windows XP SP2? What are your own engineers doing?

Robert kindly pinged Ben on the Virtual PC development team inside Microsoft and Scoble forwarded his clarification that others might find as useful as I did:

This is a known problem - which is basically that there were significant changes to Windows XP between SP1 and SP2 that means that the performance optimizations that shipped in VPC 2004 do not work under Windows XP SP2.

We are currently working on Service Pack 1 for Virtual PC 2004 - and are aiming to RTM it by the end of next week. This service pack will resolve the performance issues with Windows XP SP2 inside of a virtual machine.

In the mean time the following things can be done:

  1. Users of Virtual PC 2004 can install XP SP2 on their host computer with absolutely no problems
  2. Users can install XP SP2 inside of Virtual PC 2004 - and everything will continue to work - albeit at reduced performance
  3. If there is an urgent need to use XP SP2 at full performance before we release Virtual PC SP1 - users can install the version of the virtual machine additions that are distributed with the Virtual Server2005 Evaluation version (free download). These additions contain the optimizations need for Windows XP SP2.

Thanks, Robert and Ben!

With this advice in hand, I upgraded my home Shuttle-PC to Windows XP SP2 and both my Virtual PC software, as well as my Cisco Oracle VPN software work without a hitch. The upgrade was absolutely painless. My Norton Antivirus 2004 on my home machine seemed to already know how to coexist with XP SP2, which was nice as well.


10:10:57 AM    


© Copyright 2008 Steve Muench.