Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling getter/setter EO methods from generic framework

421852Aug 15 2006 — edited Aug 16 2006
I'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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2006
Added on Aug 15 2006
3 comments
438 views