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 08:08
Nabeel Ahmed is currently offline Nabeel AhmedFriend
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);

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:Composite Key Configuration using Dynamic Eclipse Link API
Goto Forum:

Current Time: Wed Mar 21 07:28:51 GMT 2018

Powered by FUDForum. Page generated in 0.01978 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software