Custom Class Mapping Problem - weblogic.developer.interest.kodo(Archived)

I am tring to create a custom class mapping, that overrides the default delete method and marks a "deleted flag column" to true.
So I have a class:
class A {
private String someData;
private boolean deleted = false;
// ....
So when you call somthing like this:
getPersistenceManager().deletePersistent( classInstanceA );
It just makes deleted = true
So I have a custom mapping:
public class CustomMapping extends kodo.jdbc.meta.BaseClassMapping {
public void delete(KodoStateManager sm, RowManager rm) throws SQLException {
Row row = rm.getRow(super.getTable(), Row.ACTION_UPDATE, sm, false);
Column col = super.getTable().getColumn("deleted");
row.setBoolean(col, true);
update(sm, rm);
The Problem:
It does not save the results back to the DB.
I know it calls my custom delete() mapping method. But it does not change the DB.
(The field mappings are correct because If I manually call A.setDelete(false) it changes it in the DB).
What am I missing? Do I have to mark the other column as dirty?
Thanks for any help in advance,


HELP URGENT - Entity Object Substitution not working as advertised!!!!!

Hi All,
I have done an entity Object substitution and in order to rule out any coding errors on my part I have generated a fresh EO with no code changes in it and uploaded the files to java top and updated the MDS with the substitution.
The substitution is successful but I get the following error related to my substituted file:
oracle.apps.fnd.framework.OAException: oracle.jbo.AttrValException: JBO-27019: Get method for attribute "ItemNumber" in XxEgoMtlSystemItemsVLEOEx could not be resolved. at oracle.apps.fnd.framework.OAException.wrapperException( at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException( at oracle.apps.fnd.framework.webui.OAPageBean.renderDocument( at oracle.apps.fnd.framework.webui.OAPageBean.renderDocument(
## Detail 0 ## java.lang.ClassCastException: oracle.jbo.server.EntityDefImpl incompatible with oracle.apps.fnd.framework.server.OAEntityDefImpl at at at
I think the real error is Detail 0 line but I haven't seen this before. Could this be the wrong version of JDeveloper that I have used????? About this page showed 12.1.2 and I have downloaded the JDev for 12.1.2???????
Please help I need to sort this ASAP.
Thanks all 
This error is not due to the wrong version of JDeveloper. Had you created some transient variable called ItemNumbe in XxEgoMtlSystemItemsVLEOEx.
This error occurs when there is no method called getItemNumber in This is auto generated method.
Specify me on which action does this error occurs. And what are steps you followed for EO extension.
I have not added any attributes.
Steps to do substitution
1. Created EO to extend base eo
2. Clicked Next to end of wizard and left all options defaulted
3. generated jpx file and uploaded using jpxImporter
4. Bounced OC4J
The substitution is working but something is wrong with the inheritance process as it cant invoke the getter on the parent class????
Is this due to the options on Java generation?? I have the following set:
Entity Collection Class: Not Generated
Entity Object Class: Checked with options selected for Generate Methods: "Accessors" (Data Manipulation, Validation, Create and Remove Methods) are not checked
Entity Definition Class: Not Generated
Thanks for quick response, need to get this sorted
Generate the relevant java files & all the accessor method. & run the same.
I just have, I generated everything except Data Manipulation and it still does not work
Any more ideas???????
Correct me if I am wrong but should the fact that my class extends the original not mean that if someone calls a method in the parent class against my class then it should invoke the parent class successfully even if I have not explicitly added the method to my new class and called the super???
You are completely right. As your child class inherits the parent, there is no need to define the method unless & until you want to change some logic. I am working on your requirement. let me check..
Ok some more information
I have now moved on to try and do my extension in one of the VO setters
when I run the following code all works as expected
public void setInventoryItemId(Number value) {
setAttributeInternal("InventoryItemId", value);
OADBTransaction trx = (OADBTransaction)this.getApplicationModule().getTransaction();
if ("Y".equals("Y"))
but as soon as I try to access one of the getter methods like this
public void setInventoryItemId(Number value) {
setAttributeInternal("InventoryItemId", value);
OADBTransaction trx = (OADBTransaction)this.getApplicationModule().getTransaction();
if (getAttributeInternal("StyleItemFlag").toString().equals("Y"))
Then I get a similar error message to the one I was getting in my EO
Set method for attribute \"InventoryItemId\" in EgoMtlSystemItemsVO could not be resolved
What the heck is stopping me from calling getter methods but not setters???????
in order to rule out any coding errors on my part I have generated a fresh EO with no code changes in it Does that mean, you have created a new EO instead of extending standard EO ? Pls elaborate.
2. Refer
Physically created a new class file yes but it extends the base class 
I have covered everything in the above threads and followed the EO substitution scenario exactly as per area51.
I am now getting a different error on the EO substitution, when the page loads that creates a row in the EO the following error is displayed:
1. Attribute set for InventoryItemId in view object EgoMtlSystemItemsVO failed
2. Attribute set for InventoryItemId in view object EgoMtlSystemItemsVO failed
3. Attribute set for InventoryItemId in view object EgoMtlSystemItemsVO failed
4. Attribute set for InventoryItemId in view object EgoMtlSystemItemsVO failed
This is a caught error and thrown to the top of the page as opposed to a complete stack error which is what I was getting before? At first I thought this was due to the VO substitution I had done earlier as a test but I have deleted the substitution document for the VO sub and if I remove my EO substitution the page works fine so my EO substitution is causing the problem.
EO substitution was as follows:
<Substitute OldName ="" NewName ="" />
Beginning of EO Code is as follows:
import oracle.apps.fnd.framework.server.OAEntityDefImpl;
import oracle.jbo.AttributeList;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.domain.RowID;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class XxEgoMtlSystemItemsVLEOExImpl extends EgoMtlSystemItemsVLEOImpl {
public static final int MAXATTRCONST = EntityDefImpl.getMaxAttrConst("");
public static final int GLOBALATTRIBUTE11 = MAXATTRCONST;
public static final int GLOBALATTRIBUTE12 = MAXATTRCONST + 1;
public static final int GLOBALATTRIBUTE13 = MAXATTRCONST + 2;
public static final int GLOBALATTRIBUTE14 = MAXATTRCONST + 3;
public static final int GLOBALATTRIBUTE15 = MAXATTRCONST + 4;
public static final int GLOBALATTRIBUTE16 = MAXATTRCONST + 5;
public static final int GLOBALATTRIBUTE17 = MAXATTRCONST + 6;
public static final int GLOBALATTRIBUTE18 = MAXATTRCONST + 7;
public static final int GLOBALATTRIBUTE19 = MAXATTRCONST + 8;
public static final int GLOBALATTRIBUTE20 = MAXATTRCONST + 9;
public static final int ROWID = MAXATTRCONST + 10;
private static OAEntityDefImpl mDefinitionObject;
/**This is the default constructor (do not remove)
public XxEgoMtlSystemItemsVLEOExImpl() {
/**Retrieves the definition object for this instance class.
public static synchronized EntityDefImpl getDefinitionObject() {
if (mDefinitionObject == null) {
mDefinitionObject =
return mDefinitionObject;
/**Add attribute defaulting logic in this method.
public void create(AttributeList attributeList) {
OK, so after moving to another environment I am now getting a better error message and it seems that the EO substitution is causing a problem with the bind attributes for the VO Query that sits ontop of the EO??? No idea why my understanding of the substitution framework is that I would not have to worry about the activity on the parent VO's/EO's but clearly something is either wrong with the mechanism or something is strange about this OAF application implementation (Product Data Hub aka PIM), to be honest I would not be suprised to find that it is the way the application has been wrote as I have seen some poor standards in this app already.
The EO substitution is a lost cause so I have implemented my attribute defaulting in the VO instead by using one of the setters, so rather than:
public void setInventoryItemId(Number value) {
setAttributeInternal("InventoryItemId", value);
OADBTransaction trx = (OADBTransaction)this.getApplicationModule().getTransaction();
if (super.getStyleItemFlag().compareTo("Y")==0)
I am doing:
public void setStyleItemFlag(String value) {
setAttributeInternal("StyleItemFlag", value);
OADBTransaction trx = (OADBTransaction)getApplicationModule().getTransaction();
if (value.equals("Y") )
Has the same affect and it works because I am not calling a get method
If anyone has anymore insight into this I would be interested to understand what the problem is as this process is certainly not working in the way that Oracle say it should!!!!
Further Discovery: The error message about the method not being resolved basically means that an error has occurred in the extended code!!! I had a null value coming into my parameters from the database and I hadn't put a handler in top test for this, rather than giving me a helpful error message OAF has decided to pretend it cant find the method!!!!!!
Test for nulls and handle them and it sorts this problem as regards the VO extension, from the EO perspective I think my problem is module specific although I must admit I have not looked into this further.

Own type converters in Toplink XML mapping?

I'm working on a project where we map a lot of objects to a predefined schema. This schema is a 'standard' and cannot be altered (other vendors also use this definition).
The problem we have is for instance that the date types in de schema are defined as xs:string (yyyymmdd). We would like to create a converter so that we can use Calendars in our objects for these kinds of fields.
I know I can write different getter and setter methods for this but that would mean a lot of overhead work and I would like to avoid that.
In the Toplink ORM mapping it is possible to extend the ConversionManager but this isn't possible for the OXM mapping (Toplink exception 7108: operation isn't supported on non-relational platforms).
So, does anybody know if there is another way to have Toplink OXM accept own type converters? 
Ok, I found the solution.
I used the wrong methods in the class where I registerd my ConversionManager
(the event listener class)
I had used
event.getSession().getLogin().getPlatform().setConversionManager(cm);but the getLogin() method returned a DatabaseLogin and getPlatform() returned a DatabasePlatform both are incorrect types if you want to use it with XML binding :)
So when I changed the line to
event.getSession().getDatasourceLogin().getDatasourcePlatform().setConversionManager(cm);it worked like a charm :) 
The recommended solution is to add a custom converter to your mapping. Then specify an "After Load" method on your descriptor.
To specify an After Load method in the TopLink Workbench:
- Right click the descriptor in the Navigator pane
- Choose "Select Advance Properties"
- Check the "After Load" option and click OK
- Fill in the "After Load" tab in the Editor pane (See After Load Class/Method below).
After Load Class/Method
import oracle.toplink.descriptors.ClassDescriptor;
import oracle.toplink.ox.mappings.XMLDirectMapping;
* This class contains the after load methods referred to by the descriptors.
* After load methods are required to specify settings that are not available
* in the TopLink Mapping Workbench.
public class DescriptorAfterLoads {
    public static void amendCustomerDescriptor(ClassDescriptor descriptor) {
        XMLDirectMapping hireDateMapping = (XMLDirectMapping)descriptor.getMappingForAttributeName("hireDate");
        hireDateMapping.setConverter(new DateConverter());
}Custom String/Calendar Converter
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import oracle.toplink.mappings.DatabaseMapping;
import oracle.toplink.mappings.converters.Converter;
import oracle.toplink.sessions.Session;
public class DateConverter implements Converter {
    private static SimpleDateFormat dateFormat =
        new SimpleDateFormat("yyyyMMdd");
    public Object convertObjectValueToDataValue(Object object, Session session) {
        Calendar calendar = (Calendar)object;
        return dateFormat.format(calendar.getTime());
    public Object convertDataValueToObjectValue(Object object, Session session) {
        Calendar objectValue = null;
        try {
            String dataValue = (String)object;
            Date date = dateFormat.parse(dataValue);
            objectValue = Calendar.getInstance();
        } catch (Exception e) {
            // Handle exceptions
        return objectValue;
    public boolean isMutable() {
        return false;
    public void initialize(DatabaseMapping databaseMapping, Session session) {
This solution is indeed more elegant than the one I previously used.
Thanks Blaise!

implementing queues

Hi All,
I am trying to implement Queues in JE, I need to maintain sequence in which Orders arrive (if we run out of stock, the first users win). We want to walk the queue in that order to fulfill.
Looking thru docs and forums, it sounded like EntityStore with a sequence id seemed to be right approach (tho not sure of DPL performance - how does this compare with TupleBinding ? any comments appreciated ).
But then I'd like to hide the complexity of sequence id creation from entities e.g OrderEntity. So I captured this in a super class with useful methods that I can invoke as I place the orders and remove the orders.
public class Key {
private int m_seqid = -1;
private Key() {
Key(int pSeqId) {
m_seqid = pSeqId;
public abstract class MyEntity {
private PrimaryIndex<Key, MyEntity> m_primaryIdx;
private Key m_seq;
void setKey(Key pKey) {
m_seq = pKey;
protected PrimaryIndex<Key, MyEntity> getPrimaryIndex() {
return m_primaryIdx;
void setPrimaryIndex(PrimaryIndex<Key, MyEntity> pIdx ) {
m_primaryIdx = pIdx;
public void save()
catch (Exception e)
public class OrderEntity extends MyEntity {
// sequence ids are managed in super class
private String m_xyz;
private OrderEntity() {
public OrderEntity (String _xyz) {
m_xyz = _xyz;
I create Env (transactional,), then I create EntityStore. Tried foll. combinations, and they all give exceptions, I am sure I am doing something wrong:
primaryIndex = store.getPrimaryIndex(Key.class, OrderEntity.class);
java.lang.IllegalArgumentException: Class is not persistent: com.sleepycat.persist.PrimaryIndex
primaryIndex = store.getPrimaryIndex(Key.class, MyEntity.class);
java.lang.IllegalArgumentException: Class is not persistent: com.sleepycat.persist.PrimaryIndex
If I dont declare MyEntity as #Entity, or I declare it as #Persistent, I get
java.lang.IllegalArgumentException: Not an entity class: MyEntity
AT the end of the day, all I need is a way to walk the BDB in the order of sequence ID, I dont have to use DPL. I'd like to abstract that away so derived classes such as OrderEntry dont have to worry about it. Thanks for any advice.
Hi Vissu,
Performance of DPL bindings is comparable to tuple bindings. DPL is a little slower because it's general purpose, but it's unlikely that this will make a difference.
As a first step in solving your problems, try making the MyEntity.m_primaryIdx field transient, by just adding the Java transient keyword. Of course, the index itself cannot be a persistent field of a record. By making it transient, the DPL won't complain about it. A transient field can be of any type, but a non-transient (persistent) field of an entity has to follow the rules spelled out in the DPL docs.
Persistence is explained here:


I have objects of two different classes with a common property of type string. How do I compare these values.
public class A
private string Data;
public A(java.lang.String vData)
Data = vData;
public java.lang.String getData()
return Data;
public class B
private string Data;
public B(java.lang.String vData)
Data = vData;
public java.lang.String getData()
return Data;
I create the objects of these classes and add them to the facts list.
Object [] facts;
java.util.ArrayList factsList = new java.util.ArrayList();
A objA = new A("SomeData");
B objB = new B("SomeData");
facts = factsList.toArray();
I have written the rule as follows, but its not working:
     <rule is-complete="true">
          <description>Data should be equal</description>
               <equal-to xmlns="">
               <new-instance xmlns="">
                         <string xmlns="">Status OK</string>
Whats wrong with the rule above?
Do I have to manually iterate through the objects in the working memory. If so, how?
Also there may be 'n' numbers of objects of class A and class B in the working memory.
Thanks in advance.

Accessing complex types in CQL

I have a event type defined as a java class A which has a member class B. Now how do i populate the members of class B using CQL.
Hope my questions is clear? 
Here is an example of how to do:
SELECT b.setProp1(x).getProp1() as prop1, b.setProp2(String(hi)).getProp2() as prop2, B(prop1, prop2) as prop3 FROM S
Where S is of event-type:
class A {
B getB() {}
void setB(...) {}
class B {
B() {}
B(T prop1, String prop2) {}
T getProp1() {}
void setProp1(T) {}
String getProp2() {}
void setProp2(String) {}
And the output event-type is:
class Output {
// getters and setters for
T prop1;
String prop2;
B prop3;
Note that because you using it in the SELECT clause, you would need to get an l-value to be projected in the output, hence the need for "...getProp1() as prop1".
You should be very careful when creating side-effects by calling setters.
Ideally, you would only project the result, as in the case of "B() as prop3".
In the upcoming PS5, you will be able to do the following as well:
SELECT getB().setProp1(x).getProp1() as prop1, setB(B(prop1, prop2)).getB() as prop3 FROM S
Hi thanks for that. It was realy usefull and working too.
Now i am trying to assign values to an array member variable.
Class ABC
private XYZ[] xyzarray;
class XYZ
public XYZ(string name, string value)
private string name;
private string value;
//getter n setters...
now i am tryin
I tried Select XYZ("name","value") as xyzarray[1] from ....
It gives me syntax error saying "expecting ,.) ..."etc....
Could you please guide me... 
Unfortunately we don't support setting into an array (i.e. a[i] = value).
For that, you will have to create a proper setter method.
Thanks. that saved my time!