Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Composite Key Configuration using Dynamic Eclipse Link API
Composite Key Configuration using Dynamic Eclipse Link API [message #784221] Fri, 27 January 2012 03:08
Nabeel Ahmed is currently offline 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?
Previous Topic:Embedded object with null values in db cause instances not to be updated
Next Topic:Embedded object with null values in db cause instances not to be updated
Goto Forum:
  


Current Time: Thu Apr 17 11:42:44 EDT 2014

Powered by FUDForum. Page generated in 0.01706 seconds