← Prev in month ← Prev in thread

Section 3.9.2 of the CD2 Java spec

From
Frank Budinsky <>
Date
2010-03-22T19:53:24+00:00
ID
Thread
Section 3.9.2 of the CD2 Java spec
There's an example of using JavaHelper on lines 479-483, but it's all messed up. It's calling the deprecated TypeHelper.define(Class) method and then calling a nonexistent create(Type) method on the JavaHelper. I'm not sure what happened there :-)

Anyway, since the spec says that JavaHelper.create(Class) calls define(Class), the example could just call it:

Customer c = SDO.getDefaultHelperContext().getJavaHelper().create(Customer.class);

((DataObject)c).set(“lastName”,”Smith”);

System.out.println(c.getLastName());
 

Either that, or we could also show how to do it using DataFactory.create():

Type t = SDO.getDefaultHelperContext().getJavaHelper().define(Customer.class);

DataObject o = SDO.getDefaultHelperContext().getDataFactory().create(t);

o.set(“lastName”,”Smith”);

System.out.println(((Customer)o).getLastName());

Maybe we want them both.

Frank.
← Prev in month ← Prev in thread