use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class AboutToInsertProject method buildAboutToInsertSingleTableObjectRelationalDataTypeDescriptor.
public RelationalDescriptor buildAboutToInsertSingleTableObjectRelationalDataTypeDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.events.AboutToInsertSingleTableObject.class);
descriptor.addTableName("AboutToInsertSingle");
descriptor.addPrimaryKeyFieldName("AboutToInsertSingle.ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setAlias("AboutToInsertSingleTableObject");
descriptor.setSequenceNumberFieldName("ID");
descriptor.setSequenceNumberName("SINGLE_SEQ");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setGetMethodName("getId");
idMapping.setSetMethodName("setId");
idMapping.setFieldName("AboutToInsertSingle.ID");
descriptor.addMapping(idMapping);
descriptor.getEventManager().addListener(new AboutToInsertEventAdapter("AboutToInsertSingle", "EXTRA_NUMBER"));
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Address method descriptor.
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
/* First define the class, table and descriptor properties. */
descriptor.setJavaClass(Address.class);
descriptor.setTableName("EADDRESS");
descriptor.setPrimaryKeyFieldName("ID");
descriptor.setSequenceNumberName("SEQ");
descriptor.setSequenceNumberFieldName("ID");
/* Next define the attribute mappings. */
descriptor.addDirectMapping("id", "ID");
descriptor.addDirectMapping("address", "DESCR");
descriptor.getQueryManager().setUpdateQuery(new org.eclipse.persistence.queries.UpdateObjectQuery("UPDATE EADDRESS SET DESCR = #DESCR WHERE ID = #ID"));
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildAddressVLIODescriptor.
public RelationalDescriptor buildAddressVLIODescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.AddressVLIO.class);
descriptor.addTableName("ADDRESSVLIO");
descriptor.addPrimaryKeyFieldName("ADDRESSVLIO.ADDRESS_ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("ADDRESSVLIO.ADDRESS_ID");
descriptor.setSequenceNumberName("ADDRVLIO_SEQ");
descriptor.useVersionLocking("VERSION", false);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("ADDRESSVLIO.ADDRESS_ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping streetMapping = new DirectToFieldMapping();
streetMapping.setAttributeName("street");
streetMapping.setFieldName("ADDRESSVLIO.STREET");
descriptor.addMapping(streetMapping);
DirectToFieldMapping cityMapping = new DirectToFieldMapping();
cityMapping.setAttributeName("city");
cityMapping.setFieldName("ADDRESSVLIO.CITY");
descriptor.addMapping(cityMapping);
DirectToFieldMapping provinceMapping = new DirectToFieldMapping();
provinceMapping.setAttributeName("province");
provinceMapping.setFieldName("ADDRESSVLIO.PROVINCE");
descriptor.addMapping(provinceMapping);
DirectToFieldMapping postalCodeMapping = new DirectToFieldMapping();
postalCodeMapping.setAttributeName("postalCode");
postalCodeMapping.setFieldName("ADDRESSVLIO.P_CODE");
descriptor.addMapping(postalCodeMapping);
DirectToFieldMapping countryMapping = new DirectToFieldMapping();
countryMapping.setAttributeName("country");
countryMapping.setFieldName("ADDRESSVLIO.COUNTRY");
descriptor.addMapping(countryMapping);
DirectToFieldMapping versionMapping = new DirectToFieldMapping();
versionMapping.setAttributeName("version");
versionMapping.setFieldName("ADDRESSVLIO.VERSION");
descriptor.addMapping(versionMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildPhoneNumberVLICDescriptor.
public RelationalDescriptor buildPhoneNumberVLICDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.PhoneNumberVLIC.class);
descriptor.addTableName("PHONEVLIC");
descriptor.addPrimaryKeyFieldName("PHONEVLIC.EMP_ID");
descriptor.addPrimaryKeyFieldName("PHONEVLIC.TYPE");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping typeMapping = new DirectToFieldMapping();
typeMapping.setAttributeName("type");
typeMapping.setFieldName("PHONEVLIC.TYPE");
descriptor.addMapping(typeMapping);
DirectToFieldMapping areaCodeMapping = new DirectToFieldMapping();
areaCodeMapping.setAttributeName("areaCode");
areaCodeMapping.setFieldName("PHONEVLIC.AREA_CODE");
descriptor.addMapping(areaCodeMapping);
DirectToFieldMapping numberMapping = new DirectToFieldMapping();
numberMapping.setAttributeName("number");
numberMapping.setFieldName("PHONEVLIC.P_NUMBER");
descriptor.addMapping(numberMapping);
OneToOneMapping ownerMapping = new OneToOneMapping();
ownerMapping.setAttributeName("owner");
ownerMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.EmployeeVLIC.class);
ownerMapping.useBasicIndirection();
ownerMapping.addForeignKeyFieldName("PHONEVLIC.EMP_ID", "EMPLOYEEVLIC.EMP_ID");
descriptor.addMapping(ownerMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Promoter method descriptor.
// Movie descriptor
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Promoter.class);
descriptor.setTableName("RO_PROMO");
descriptor.addPrimaryKeyFieldName("PROMO_ID");
descriptor.setSequenceNumberName("PROMO_SEQ");
descriptor.setSequenceNumberFieldName("PROMO_ID");
descriptor.addDirectMapping("id", "PROMO_ID");
descriptor.addDirectMapping("name", "NAME");
/*
// The promoter operates in a collection of countries.
org.eclipse.persistence.mappings.OneToManyMapping phoneNumbersMapping = new org.eclipse.persistence.mappings.OneToManyMapping() ;
phoneNumbersMapping.setAttributeName("phoneNumbers");
phoneNumbersMapping.setReferenceClass(PhoneNumber.class);
phoneNumbersMapping.setTargetForeignKeyFieldName("PROMO_ID");
phoneNumbersMapping.privateOwnedRelationship();
// phoneNumbersMapping.dontUseIndirection();
descriptor.addMapping(phoneNumbersMapping);
*/
return descriptor;
}
Aggregations