use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class BigBadProject method buildBigBadObjectDescriptor.
public RelationalDescriptor buildBigBadObjectDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.bigbad.BigBadObject.class);
descriptor.addTableName("BIG_BAD_OBJ");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID01");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID02");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID03");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID04");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID05");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID06");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID07");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID08");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID09");
descriptor.addPrimaryKeyFieldName("BIG_BAD_OBJ.ID10");
// strings
for (int index = 0; index < 20; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("string" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.STRING_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// ids (after to check indexing)
for (int index = 0; index < 10; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("id" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.ID" + indexString);
descriptor.addMapping(directMapping);
}
// calendar
for (int index = 0; index < 10; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("calendar" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.CALENDAR_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// date
for (int index = 0; index < 10; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("date" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.DATE_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// time
for (int index = 0; index < 10; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("time" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.TIME_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// timestamp
for (int index = 0; index < 10; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("timestamp" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.TIMESTAMP_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// largestring
for (int index = 0; index < 3; index++) {
DirectToFieldMapping directMapping = new DirectToFieldMapping();
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
directMapping.setAttributeName("largeString" + indexString);
directMapping.setFieldName("BIG_BAD_OBJ.LSTRING_DATA" + indexString);
descriptor.addMapping(directMapping);
}
// blob
DirectToFieldMapping directMapping = new DirectToFieldMapping();
directMapping.setAttributeName("blob");
directMapping.setFieldName("BIG_BAD_OBJ.BLOB_DATA");
descriptor.addMapping(directMapping);
// serialized blob
directMapping = new DirectToFieldMapping();
directMapping.setAttributeName("serializedBlob");
directMapping.setFieldName("BIG_BAD_OBJ.SER_DATA");
directMapping.setConverter(new SerializedObjectConverter());
descriptor.addMapping(directMapping);
// numbers
directMapping = new DirectToFieldMapping();
directMapping.setAttributeName("number01");
directMapping.setFieldName("BIG_BAD_OBJ.NUM_DATA01");
descriptor.addMapping(directMapping);
directMapping = new DirectToFieldMapping();
directMapping.setAttributeName("number02");
directMapping.setFieldName("BIG_BAD_OBJ.NUM_DATA02");
descriptor.addMapping(directMapping);
// aggregates
for (int index = 0; index < 3; index++) {
AggregateObjectMapping aggMapping = new AggregateObjectMapping();
aggMapping.setReferenceClass(BigBadAggregate.class);
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
aggMapping.setAttributeName("agg" + indexString);
aggMapping.addFieldNameTranslation("BIG_BAD_OBJ.AGG_STRING" + indexString, "string");
aggMapping.addFieldNameTranslation("BIG_BAD_OBJ.AGG_NUM" + indexString, "number");
descriptor.addMapping(aggMapping);
}
// 1-1
for (int index = 0; index < 3; index++) {
OneToOneMapping oneToOneMapping = new OneToOneMapping();
oneToOneMapping.setReferenceClass(BigBadReferenceData.class);
String indexString = String.valueOf(index + 1);
if (indexString.length() == 1) {
indexString = "0" + indexString;
}
oneToOneMapping.setAttributeName("ref" + indexString);
oneToOneMapping.addForeignKeyFieldName("BIG_BAD_OBJ.REF_FK" + indexString, "BIG_BAD_DATA.ID");
descriptor.addMapping(oneToOneMapping);
}
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class BigBadProject method buildBigBadAggregateDescriptor.
public RelationalDescriptor buildBigBadAggregateDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.descriptorIsAggregate();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.bigbad.BigBadAggregate.class);
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("number");
idMapping.setFieldName("number");
descriptor.addMapping(idMapping);
DirectToFieldMapping dataMapping = new DirectToFieldMapping();
dataMapping.setAttributeName("string");
dataMapping.setFieldName("string");
descriptor.addMapping(dataMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class CollectionsProject method buildLocationDescriptor.
/**
* TopLink generated descriptor method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void buildLocationDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(Location.class);
java.util.Vector vector = new java.util.Vector();
vector.addElement("COL_LOCA");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("COL_LOCA.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("LOCA_ID");
descriptor.setSequenceNumberFieldName("ID");
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("id");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setGetMethodName("getId");
directtofieldmapping.setSetMethodName("setId");
directtofieldmapping.setFieldName("COL_LOCA.ID");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("area");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setGetMethodName("getArea");
directtofieldmapping1.setSetMethodName("setArea");
directtofieldmapping1.setFieldName("COL_LOCA.AREA");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping2.setAttributeName("city");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setGetMethodName("getCity");
directtofieldmapping2.setSetMethodName("setCity");
directtofieldmapping2.setFieldName("COL_LOCA.CITY");
descriptor.addMapping(directtofieldmapping2);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class CollectionsProject method buildWaiterDescriptor.
/**
* TopLink generated descriptor method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void buildWaiterDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(org.eclipse.persistence.testing.models.collections.Waiter.class);
java.util.Vector vector = new java.util.Vector();
vector.addElement("COL_PERS");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("COL_PERS.ID");
descriptor.getInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.collections.Person.class);
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("specialty");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setGetMethodName("getSpecialty");
directtofieldmapping.setSetMethodName("setSpecialty");
directtofieldmapping.setFieldName("COL_PERS.SPECIALT");
descriptor.addMapping(directtofieldmapping);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("employer");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(true);
onetoonemapping.setGetMethodName("getEmployerHolder");
onetoonemapping.setSetMethodName("setEmployerHolder");
onetoonemapping.setReferenceClass(Restaurant.class);
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("COL_PERS.W_RST_ID", "COL_REST.ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class CollectionsProject method buildMenuDescriptor.
/**
* TopLink generated descriptor method.
* <b>WARNING</b>: This code was generated by an automated tool.
* Any changes will be lost when the code is re-generated
*/
protected void buildMenuDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(Menu.class);
Vector vector = new Vector();
vector.addElement("COL_MENU");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("COL_MENU.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("MENU_ID");
descriptor.setSequenceNumberFieldName("ID");
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("id");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setGetMethodName("getId");
directtofieldmapping.setSetMethodName("setId");
directtofieldmapping.setFieldName("COL_MENU.ID");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("type");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setGetMethodName("getType");
directtofieldmapping1.setSetMethodName("setType");
directtofieldmapping1.setFieldName("COL_MENU.TYPE");
descriptor.addMapping(directtofieldmapping1);
// SECTION: ONETOMANYMAPPING
org.eclipse.persistence.mappings.OneToManyMapping onetomanymapping = new org.eclipse.persistence.mappings.OneToManyMapping();
onetomanymapping.setAttributeName("items");
onetomanymapping.setIsReadOnly(false);
onetomanymapping.setUsesIndirection(true);
onetomanymapping.setGetMethodName("getItemsHolder");
onetomanymapping.setSetMethodName("setItemsHolder");
onetomanymapping.setReferenceClass(org.eclipse.persistence.testing.models.collections.MenuItem.class);
onetomanymapping.setIsPrivateOwned(true);
onetomanymapping.addTargetForeignKeyFieldName("COL_M_IT.MENU_ID", "COL_MENU.ID");
onetomanymapping.useCollectionClass(java.util.LinkedList.class);
descriptor.addMapping(onetomanymapping);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("owner");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(true);
onetoonemapping.setGetMethodName("getOwnerHolder");
onetoonemapping.setSetMethodName("setOwnerHolder");
onetoonemapping.setReferenceClass(Restaurant.class);
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("COL_MENU.REST_ID", "COL_REST.ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
Aggregations