use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class IllegalArgumentWhileSettingValueThruInstanceVariableAccessorTest method descriptor.
public RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess.class);
descriptor.addTableName("EMPLOYEE");
descriptor.addPrimaryKeyFieldName("EMPLOYEE.EMP_ID");
// Descriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("EMP_ID");
descriptor.setSequenceNumberName("EMP_SEQ");
descriptor.setAlias("EMPLOYEE");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping p_idMapping = new DirectToFieldMapping();
p_idMapping.setAttributeName("p_id");
p_idMapping.setFieldName("EMPLOYEE.EMP_ID");
descriptor.addMapping(p_idMapping);
DirectToFieldMapping p_nameMapping = new DirectToFieldMapping();
p_nameMapping.setAttributeName("p_name");
p_nameMapping.setFieldName("EMPLOYEE.F_NAME");
descriptor.addMapping(p_nameMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class DescriptorForInterfaceIsMissingTest method buildProjectDescriptor.
public RelationalDescriptor buildProjectDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.domain.Project.class);
descriptor.addTableName("PROJECT");
descriptor.addPrimaryKeyFieldName("PROJECT.PROJ_ID");
// Inheritance properties.
descriptor.getInheritancePolicy().setClassIndicatorFieldName("PROJ_TYPE");
descriptor.getInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.employee.domain.LargeProject.class, "L");
descriptor.getInheritancePolicy().addClassIndicator(org.eclipse.persistence.testing.models.employee.domain.SmallProject.class, "S");
// Interface properties.
// the following causes the correct error to occure.
descriptor.getInterfacePolicy().addParentInterface(org.eclipse.persistence.testing.models.employee.interfaces.LargeProject.class);
// Descriptor properties.
descriptor.useFullIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteFullIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("PROJ_ID");
descriptor.setSequenceNumberName("PROJ_SEQ");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Event manager.
// Mappings.
DirectToFieldMapping descriptionMapping = new DirectToFieldMapping();
descriptionMapping.setAttributeName("description");
descriptionMapping.setFieldName("PROJECT.DESCRIP");
descriptionMapping.setNullValue("");
descriptor.addMapping(descriptionMapping);
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("PROJECT.PROJ_ID");
descriptor.addMapping(idMapping);
/* OneToOneMapping teamLeaderMapping = new OneToOneMapping();
teamLeaderMapping.setAttributeName("teamLeader");
teamLeaderMapping.setReferenceClass(org.eclipse.persistence.testing.models.employee.domain.Employee.class);
teamLeaderMapping.useBasicIndirection();
teamLeaderMapping.addForeignKeyFieldName("PROJECT.LEADER_ID", "EMPLOYEE.EMP_ID");
descriptor.addMapping(teamLeaderMapping);
*/
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class JGeometryProject method buildWrappedSpatialDescriptor.
public ClassDescriptor buildWrappedSpatialDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial.class);
descriptor.addTableName("WRAPPED_SPATIAL");
descriptor.addPrimaryKeyFieldName("WRAPPED_SPATIAL.GID");
// Descriptor Properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setAlias("WrappedSpatial");
descriptor.setAmendmentClass(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.TopLinkAfterLoad.class);
descriptor.setAmendmentMethodName("afterLoadWrappedSpatial");
// Query Manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries.
// Named Query -- findAllWrappedSpatial
ReadAllQuery namedQuery0 = new ReadAllQuery(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial.class);
namedQuery0.setName("findAllWrappedSpatial");
namedQuery0.setQueryTimeout(0);
namedQuery0.setCacheUsage(ObjectLevelReadQuery.CheckCacheByPrimaryKey);
namedQuery0.setLockMode(ObjectLevelReadQuery.NO_LOCK);
descriptor.getQueryManager().addQuery("findAllWrappedSpatial", namedQuery0);
// Event Manager.
// Query keys.
descriptor.addDirectQueryKey("geometry.id", "WRAPPED_SPATIAL.GEOMETRY.ID");
descriptor.addDirectQueryKey("geometry.geom", "WRAPPED_SPATIAL.GEOMETRY.GEOM");
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("WRAPPED_SPATIAL.GID");
descriptor.addMapping(idMapping);
DirectToFieldMapping geometryMapping = new DirectToFieldMapping();
geometryMapping.setAttributeName("geometry");
ObjectRelationalDatabaseField f = new ObjectRelationalDatabaseField("WRAPPED_SPATIAL.GEOMETRY");
geometryMapping.setField(f);
geometryMapping.setFieldType(java.sql.Types.STRUCT);
descriptor.addMapping(geometryMapping);
descriptor.applyAmendmentMethod();
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class JGeometryProject method buildSimpleSpatialDescriptor.
public ClassDescriptor buildSimpleSpatialDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial.class);
descriptor.addTableName("SIMPLE_SPATIAL");
descriptor.addPrimaryKeyFieldName("SIMPLE_SPATIAL.GID");
// Descriptor Properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setAlias("SimpleSpatial");
// Query Manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries.
// Named Query -- findAllSimpleSpatial
ReadAllQuery namedQuery0 = new ReadAllQuery(org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial.class);
namedQuery0.setName("findAllSimpleSpatial");
namedQuery0.setQueryTimeout(0);
namedQuery0.setCacheUsage(ObjectLevelReadQuery.CheckCacheByPrimaryKey);
namedQuery0.setLockMode(ObjectLevelReadQuery.NO_LOCK);
descriptor.getQueryManager().addQuery("findAllSimpleSpatial", namedQuery0);
// Event Manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("SIMPLE_SPATIAL.GID");
descriptor.addMapping(idMapping);
DirectToFieldMapping geometryMapping = new DirectToFieldMapping();
geometryMapping.setAttributeName("geometry");
ObjectRelationalDatabaseField f = new ObjectRelationalDatabaseField("SIMPLE_SPATIAL.GEOMETRY");
geometryMapping.setField(f);
geometryMapping.setFieldType(java.sql.Types.STRUCT);
descriptor.addMapping(geometryMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ProjectProject method buildLargeBusinessProjectDescriptor.
/**
* 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 buildLargeBusinessProjectDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(org.eclipse.persistence.testing.models.multipletable.LargeBusinessProject.class);
descriptor.getInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.multipletable.BusinessProject.class);
Vector vector = new Vector();
vector.addElement("LPROJ");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("LPROJ.PROJ_ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.getInheritancePolicy().setShouldReadSubclasses(false);
// 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("milestoneVersion");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("LPROJ.MILESTONE");
descriptor.addMapping(directtofieldmapping);
// SECTION: ONETOONEMAPPING
org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping = new org.eclipse.persistence.mappings.OneToOneMapping();
onetoonemapping.setAttributeName("budget");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(false);
onetoonemapping.setReferenceClass(org.eclipse.persistence.testing.models.multipletable.Budget.class);
onetoonemapping.setIsPrivateOwned(true);
onetoonemapping.addForeignKeyFieldName("LPROJ.BUDGET_ID", "BUDGET.ID");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
Aggregations