Composite Key Configuration using Dynamic Eclipse Link API [message #784221] |
Fri, 27 January 2012 08:08 |
Nabeel Ahmed Messages: 20 Registered: January 2012 |
Junior Member |
|
|
I m try to configure a Dynamic Type which have composite primary key, but i am having a problem in its configuration.
/*
* Configuring ProductKey
*/
JPADynamicTypeBuilder productKeyTypeBuilder = new JPADynamicTypeBuilder(classLoader.createDynamicClass(packageName + "ProductKey"), null);
productKeyTypeBuilder.addDirectMapping("ProductID", int.class,"ProductID");
productKeyTypeBuilder.addDirectMapping("ProductName", String.class, "ProductName");
/*
* Configuring Products
*/
JPADynamicTypeBuilder productTypeBuilder = new JPADynamicTypeBuilder(classLoader.createDynamicClass(packageName + "Products"), null, "Products");
productTypeBuilder.addDirectMapping("QuantityPerUnit", String.class,"QuantityPerUnit");
productTypeBuilder.addDirectMapping("UnitPrice", Double.class, "UnitPrice");
productTypeBuilder.addDirectMapping("UnitsInStock", Short.class, "UnitsInStock");
productTypeBuilder.addDirectMapping("UnitsOnOrder", Short.class, "UnitsOnOrder");
productTypeBuilder.addDirectMapping("ReorderLevel", Short.class, "ReorderLevel");
productTypeBuilder.addDirectMapping("Discontinued", Boolean.class, "Discontinued");
AggregateObjectMapping aom = productTypeBuilder.addAggregateObjectMapping("ProductKey", productKeyTypeBuilder.getType(), true);
aom.setIsPrimaryKeyMapping(true);
aom.setIsReadOnly(false);
and i m getting errors in it.
am i missing anything?
any help?
|
|
|
Powered by
FUDForum. Page generated in 0.03099 seconds