Skip to main content


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);
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: Sat Apr 20 16:26:44 GMT 2024

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

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

Back to the top