use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Actor method descriptor.
// Actor descriptor
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Actor.class);
descriptor.setTableName("RO_ACTOR");
descriptor.setPrimaryKeyFieldName("ACT_ID");
descriptor.setSequenceNumberName("SEQ");
descriptor.setSequenceNumberFieldName("ACT_ID");
descriptor.addDirectMapping("id", "ACT_ID");
descriptor.addDirectMapping("name", "ACT_NAME");
descriptor.addDirectMapping("minimumSalary", "MIN_SAL");
ManyToManyMapping moviesMapping = new ManyToManyMapping();
moviesMapping.setAttributeName("movies");
moviesMapping.setReferenceClass(Movie.class);
moviesMapping.setRelationTableName("ACT_MOV");
moviesMapping.setSourceRelationKeyFieldName("ACT_ID");
moviesMapping.setTargetRelationKeyFieldName("MOV_ID");
moviesMapping.dontUseIndirection();
moviesMapping.readOnly();
descriptor.addMapping(moviesMapping);
// ManyToManyMapping: charities
ManyToManyMapping charitiesMapping = new ManyToManyMapping();
charitiesMapping.setAttributeName("charities");
charitiesMapping.setReferenceClass(ReadOnlyCharity.class);
charitiesMapping.setRelationTableName("ACT_CHA");
charitiesMapping.setSourceRelationKeyFieldName("ACT_ID");
charitiesMapping.setTargetRelationKeyFieldName("CHARITY_ID");
charitiesMapping.dontUseIndirection();
descriptor.addMapping(charitiesMapping);
// OneToOneMapping: hollywoodAgent
OneToOneMapping hollywoodAgentMapping = new OneToOneMapping();
hollywoodAgentMapping.setAttributeName("hollywoodAgent");
hollywoodAgentMapping.setReferenceClass(ReadOnlyHollywoodAgent.class);
hollywoodAgentMapping.addForeignKeyFieldName("HOLLYWOODAGENT_ID", "HOLLYWOODAGENT_ID");
hollywoodAgentMapping.dontUseIndirection();
// hollywoodAgentMapping.readOnly();
descriptor.addMapping(hollywoodAgentMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Charity method descriptor.
// Charity descriptor
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Charity.class);
descriptor.setTableName("CHARITY");
descriptor.addPrimaryKeyFieldName("CHARITY_ID");
descriptor.setSequenceNumberName("CHARITY_SEQ");
descriptor.setSequenceNumberFieldName("CHARITY_ID");
descriptor.addDirectMapping("id", "CHARITY_ID");
descriptor.addDirectMapping("name", "NAME");
descriptor.addDirectMapping("donationsRaised", "DONATIONS_RAISED");
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class IndirectContainerProject method buildOrderLineDescriptor.
/**
* modifications are marked with "bjv"
*/
@Override
protected void buildOrderLineDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(orderLineClass());
Vector vector = new Vector();
vector.addElement("ORDLINE");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("ORDLINE.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setSequenceNumberName("orderline");
descriptor.setSequenceNumberFieldName("ID");
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("id");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("ORDLINE.ID");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("itemName");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("ORDLINE.ITEM_NAME");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping2.setAttributeName("quantity");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("ORDLINE.QUANTITY");
descriptor.addMapping(directtofieldmapping2);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("order");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(false);
// bjv
onetoonemapping.setReferenceClass(this.orderClass());
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("ORDLINE.ORDER_ID", "ORD.ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReadOnlyProject method buildCharityDescriptor.
protected void buildCharityDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(Charity.class);
descriptor.setTableName("CHARITY");
descriptor.addPrimaryKeyFieldName("CHARITY_ID");
descriptor.setSequenceNumberName("CHARITY_SEQ");
descriptor.setSequenceNumberFieldName("CHARITY_ID");
descriptor.addDirectMapping("id", "CHARITY_ID");
descriptor.addDirectMapping("name", "NAME");
descriptor.addDirectMapping("donationsRaised", "DONATIONS_RAISED");
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReadOnlyProject method buildReadOnlyHollywoodAgentDescriptor.
protected void buildReadOnlyHollywoodAgentDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(ReadOnlyHollywoodAgent.class);
descriptor.setTableName("HOLLYWOODAGENT");
descriptor.addPrimaryKeyFieldName("HOLLYWOODAGENT_ID");
descriptor.setSequenceNumberName("HOLLYWOODAGENT_SEQ");
descriptor.setSequenceNumberFieldName("HOLLYWOODAGENT_ID");
descriptor.addDirectMapping("id", "HOLLYWOODAGENT_ID");
descriptor.addDirectMapping("name", "NAME");
addDescriptor(descriptor);
addDefaultReadOnlyClass(ReadOnlyHollywoodAgent.class);
}
Aggregations