use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class TimestampVersion method descriptor.
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(TimestampVersion.class);
Vector vector = new Vector();
vector.addElement("TSAO_LCK");
descriptor.setTableNames(vector);
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.descriptorIsAggregate();
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping.setAttributeName("t_id");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("TSAO_LCK.AGG_VERSION");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping2.setAttributeName("versionInfo");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("TSAO_LCK.AGG_INFO");
descriptor.addMapping(directtofieldmapping2);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class DistributedProject method buildCompanyDescriptor.
public RelationalDescriptor buildCompanyDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.tests.distributedservers.Company.class);
descriptor.addTableName("DIST_COMPANY");
descriptor.addPrimaryKeyFieldName("DIST_COMPANY.ID");
// Descriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("DIST_COMPANY.ID");
descriptor.setSequenceNumberName("COMAPNY_SEQ");
descriptor.setAlias("Company");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("DIST_COMPANY.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping nameMapping = new DirectToFieldMapping();
nameMapping.setAttributeName("name");
nameMapping.setFieldName("DIST_COMPANY.NAME");
descriptor.addMapping(nameMapping);
OneToManyMapping ownedItemsMapping = new OneToManyMapping();
ownedItemsMapping.setAttributeName("ownedItems");
ownedItemsMapping.setReferenceClass(org.eclipse.persistence.testing.tests.distributedservers.Item.class);
ownedItemsMapping.dontUseIndirection();
ownedItemsMapping.useCollectionClass(java.util.Vector.class);
ownedItemsMapping.addTargetForeignKeyFieldName("DIST_ITEM.COMPANYOWNER", "DIST_COMPANY.ID");
descriptor.addMapping(ownedItemsMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class DistributedProject method buildDist_EmployeeDescriptor.
public RelationalDescriptor buildDist_EmployeeDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.tests.distributedservers.Dist_Employee.class);
descriptor.addTableName("DIST_EMPLOYEE");
descriptor.addPrimaryKeyFieldName("DIST_EMPLOYEE.ID");
// Descriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("DIST_EMPLOYEE.ID");
descriptor.setSequenceNumberName("EMPLOYEE_SEQ");
descriptor.setAlias("Dist_Employee");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("DIST_EMPLOYEE.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping nameMapping = new DirectToFieldMapping();
nameMapping.setAttributeName("name");
nameMapping.setFieldName("DIST_EMPLOYEE.NAME");
descriptor.addMapping(nameMapping);
OneToManyMapping heldItemsMapping = new OneToManyMapping();
heldItemsMapping.setAttributeName("heldItems");
heldItemsMapping.setReferenceClass(org.eclipse.persistence.testing.tests.distributedservers.Item.class);
heldItemsMapping.dontUseIndirection();
heldItemsMapping.useCollectionClass(java.util.Vector.class);
heldItemsMapping.addTargetForeignKeyFieldName("DIST_ITEM.EMPLOYEEHOLDER", "DIST_EMPLOYEE.ID");
descriptor.addMapping(heldItemsMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class IsolatedEmployeeProject method buildIsolatedParentDescriptor.
public RelationalDescriptor buildIsolatedParentDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(IsolatedParent.class);
descriptor.addTableName("ISOLATED_PARENT");
descriptor.addPrimaryKeyFieldName("ISOLATED_PARENT.ID");
// ClassDescriptor Properties.
descriptor.useFullIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteFullIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("ISOLATED_PARENT.ID");
descriptor.setSequenceNumberName("PARENT_SEQ");
// IMPORTANT!
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.setCacheIsolation(CacheIsolationType.ISOLATED);
descriptor.setAlias("IsolatedParent");
descriptor.setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);
descriptor.setAmendmentClass(IsolatedParent.class);
descriptor.setAmendmentMethodName("afterLoad");
// Query Manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries.
// Named Query -- findParentBySerial
ReadObjectQuery namedQuery0 = new ReadObjectQuery(IsolatedParent.class);
namedQuery0.setName("findParentBySerial");
namedQuery0.setShouldBindAllParameters(true);
ExpressionBuilder expBuilder0 = namedQuery0.getExpressionBuilder();
namedQuery0.setSelectionCriteria(expBuilder0.get("serial").equal(expBuilder0.getParameter("serial_p")));
namedQuery0.addArgument("serial_p", java.lang.String.class);
descriptor.getQueryManager().addQuery("findParentBySerial", namedQuery0);
// Event Manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("ISOLATED_PARENT.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping serialMapping = new DirectToFieldMapping();
serialMapping.setAttributeName("serial");
serialMapping.setFieldName("ISOLATED_PARENT.SERIAL");
descriptor.addMapping(serialMapping);
OneToManyMapping childrenMapping = new OneToManyMapping();
childrenMapping.setAttributeName("children");
childrenMapping.setReferenceClass(IsolatedChild.class);
childrenMapping.useTransparentCollection();
childrenMapping.useCollectionClass(org.eclipse.persistence.indirection.IndirectList.class);
childrenMapping.addTargetForeignKeyFieldName("ISOLATED_CHILD.PARENT_ID", "ISOLATED_PARENT.ID");
childrenMapping.privateOwnedRelationship();
descriptor.addMapping(childrenMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class IsolatedEmployeeProject method buildIsolatedChildDescriptor.
public RelationalDescriptor buildIsolatedChildDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(IsolatedChild.class);
descriptor.addTableName("ISOLATED_CHILD");
descriptor.addPrimaryKeyFieldName("ISOLATED_CHILD.ID");
// ClassDescriptor Properties.
descriptor.useFullIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteFullIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("ISOLATED_CHILD.ID");
descriptor.setSequenceNumberName("CHILD_SEQ");
// IMPORTANT!
descriptor.alwaysConformResultsInUnitOfWork();
descriptor.setCacheIsolation(CacheIsolationType.ISOLATED);
descriptor.setAlias("IsolatedChild");
descriptor.setCacheSynchronizationType(ClassDescriptor.DO_NOT_SEND_CHANGES);
// Query Manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Event Manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("ISOLATED_CHILD.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping serialMapping = new DirectToFieldMapping();
serialMapping.setAttributeName("serial");
serialMapping.setFieldName("ISOLATED_CHILD.SERIAL");
descriptor.addMapping(serialMapping);
DirectToFieldMapping deletedMapping = new DirectToFieldMapping();
deletedMapping.setAttributeName("deleted");
deletedMapping.setFieldName("ISOLATED_CHILD.DELETED");
descriptor.addMapping(deletedMapping);
OneToOneMapping parentMapping = new OneToOneMapping();
parentMapping.setAttributeName("parent");
parentMapping.setReferenceClass(IsolatedParent.class);
parentMapping.useBasicIndirection();
parentMapping.addForeignKeyFieldName("ISOLATED_CHILD.PARENT_ID", "ISOLATED_PARENT.ID");
descriptor.addMapping(parentMapping);
return descriptor;
}
Aggregations