The findByPrimaryKey() method of oracle.jbo.server.EntityDefImpl will check to see if an entity object of the given key passed in exists in the cache, and if not, it will attempt to fault it in from the database using the value of the primary key that you've passed in.
Have you ever wanted to quickly check whether an entity object was in the cache without causing the database fault-in? Common scenarios include fast existence checking where your code might first want to check that the entity is not in the cache, but if it's not it may want to simply execute a fast existence check query instead of faulting all of that entities attributes into the entity cache.
In 9.0.3.3 and beyond, the new findInCacheByPrimaryKey() method lets you do just this.
To get hold of any entity object's definition object, just call the static getDefinitionObject() method on the desired entity object class, or if you haven't generated a Java class for your entity, you can still access its definition by using the static findDefObject() method on EntityDefImpl itself, passing in the fully-qualified name of the entity like:
EntityDefImpl def = EntityDefImpl.findDefObject("com.myco.app.MyEntity");
3:12:36 PM
|