Calling getter/setter EO methods from generic framework
421852Aug 15 2006 — edited Aug 16 2006I'm working on a framework that would generically do things at the entity object layer to set column values such as getting a sequence automatically. It's a pretty easy task if you're doing it from the primary enttity object:
SequenceImpl sequence = new SequenceImpl("MY_SEQUENCE", getDBTransaction());
setMyPrimaryKey(sequence.getSequenceNumber());
What I'd like to do is in my generic entityImpl code use custom properties to define which column is the primary key and the name of the appropriate sequence generator so I can grab it and create it in my generic class. I've got the custom property code working:
protected void create(AttributeList AttributeList) {
System.out.println("starting create");
EntityDefImpl def = getEntityDef();
HashMap eoProps = def.getPropertiesMap();
if (eoProps != null && eoProps.size() > 0) {
Iterator iter = eoProps.keySet().iterator();
ArrayList otherAttrIndices = null;
while (iter.hasNext()) {
String curPropName = (String)iter.next();
if (curPropName.equalsIgnoreCase("sequence")) {
System.out.println("Sequence found = "+curPropName);
String curPropValue = (String)eoProps.get(curPropName);
System.out.println("Sequence name=" +curPropValue);
StringTokenizer st = new StringTokenizer(curPropValue, ",");
SequenceImpl sequence = new SequenceImpl(curPropValue,getDBTransaction());
//code goes here to call the setter routine
//setMyPrimaryKey(sequence.getSequenceNumber());
}
}
super.create(AttributeList);
}
}
Is it possible to call my setter? How can I set the value from here?