use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReadOnlyProject method buildAddressDescriptor.
/**
* TopLink generated 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 buildAddressDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Address.class);
Vector vector = new Vector();
vector.addElement("RO_ADDR");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("RO_ADDR.ADD_ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setSequenceNumberName("ADD_SEQ");
descriptor.setSequenceNumberFieldName("ADD_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("city");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("RO_ADDR.CITY");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("id");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("RO_ADDR.ADD_ID");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping2.setAttributeName("streetAddress");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("RO_ADDR.STREET");
descriptor.addMapping(directtofieldmapping2);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping3 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping3.setAttributeName("zipCode");
directtofieldmapping3.setIsReadOnly(false);
directtofieldmapping3.setFieldName("RO_ADDR.ZIP");
descriptor.addMapping(directtofieldmapping3);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("country");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(false);
onetoonemapping.setReferenceClass(org.eclipse.persistence.testing.models.readonly.Country.class);
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("RO_ADDR.COUNTRY_ID", "COUNTRY.COUNTRY_ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReadOnlyProject method buildHollywoodAgentDescriptor.
protected void buildHollywoodAgentDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(HollywoodAgent.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");
descriptor.addDirectMapping("numberOfConnections", "CONNECTIONS");
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReadOnlyProject method buildMovieDescriptor.
/**
* TopLink generated 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 buildMovieDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Movie.class);
Vector vector = new Vector();
vector.addElement("RO_MOVIE");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("RO_MOVIE.MOV_ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setSequenceNumberName("MOV_SEQ");
descriptor.setSequenceNumberFieldName("MOV_ID");
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: AGGREGATEOBJECTMAPPING
org.eclipse.persistence.mappings.AggregateObjectMapping aggregateobjectmapping = new org.eclipse.persistence.mappings.AggregateObjectMapping();
aggregateobjectmapping.setAttributeName("studio");
aggregateobjectmapping.setIsReadOnly(true);
aggregateobjectmapping.setReferenceClass(org.eclipse.persistence.testing.models.readonly.Studio.class);
aggregateobjectmapping.setIsNullAllowed(false);
descriptor.addMapping(aggregateobjectmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("id");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("RO_MOVIE.MOV_ID");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("title");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("RO_MOVIE.TITLE");
descriptor.addMapping(directtofieldmapping1);
// SECTION: MANYTOMANYMAPPING
org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping = new org.eclipse.persistence.mappings.ManyToManyMapping();
manytomanymapping.setAttributeName("actors");
manytomanymapping.setIsReadOnly(false);
manytomanymapping.setUsesIndirection(false);
manytomanymapping.setReferenceClass(org.eclipse.persistence.testing.models.readonly.Actor.class);
manytomanymapping.setIsPrivateOwned(true);
manytomanymapping.setRelationTableName("ACT_MOV");
manytomanymapping.addSourceRelationKeyFieldName("ACT_MOV.MOV_ID", "RO_MOVIE.MOV_ID");
manytomanymapping.addTargetRelationKeyFieldName("ACT_MOV.ACT_ID", "RO_ACTOR.ACT_ID");
descriptor.addMapping(manytomanymapping);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("promoter");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(false);
onetoonemapping.setReferenceClass(org.eclipse.persistence.testing.models.readonly.Promoter.class);
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("RO_MOVIE.PROMO_ID", "RO_PROMO.PROMO_ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class BidirectionalRelationshipProject method buildPlayerDescriptor.
public RelationalDescriptor buildPlayerDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(Player.class);
descriptor.addTableName("PLAYER");
descriptor.addPrimaryKeyFieldName("PLAYER.ID");
descriptor.setAlias("Player");
// RelationalDescriptor properties.
descriptor.useFullIdentityMap();
descriptor.setIdentityMapSize(100);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("m_id");
idMapping.setFieldName("PLAYER.ID");
descriptor.addMapping(idMapping);
OneToOneMapping onetoonemapping = new OneToOneMapping();
onetoonemapping.setAttributeName("m_team");
onetoonemapping.setReferenceClass(Team.class);
onetoonemapping.useBasicIndirection();
onetoonemapping.addForeignKeyFieldName("PLAYER.TEAM_ID", "TEAM.ID");
onetoonemapping.setRelationshipPartnerAttributeName("m_players");
descriptor.addMapping(onetoonemapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class BidirectionalRelationshipProject method buildTeamDescriptor.
public RelationalDescriptor buildTeamDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(Team.class);
descriptor.addTableName("TEAM");
descriptor.addPrimaryKeyFieldName("TEAM.ID");
// RelationalDescriptor properties.
descriptor.useFullIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("TEAM.ID");
descriptor.setSequenceNumberName("team_seq");
descriptor.setAlias("Team");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("m_id");
idMapping.setFieldName("TEAM.ID");
descriptor.addMapping(idMapping);
OneToManyMapping onetomanymapping = new OneToManyMapping();
onetomanymapping.setAttributeName("m_players");
onetomanymapping.setReferenceClass(Player.class);
onetomanymapping.useTransparentMap("getId");
onetomanymapping.addTargetForeignKeyFieldName("PLAYER.TEAM_ID", "TEAM.ID");
descriptor.addMapping(onetomanymapping);
return descriptor;
}
Aggregations