use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class SwitchProject method buildSwitchStateONDescriptor.
public RelationalDescriptor buildSwitchStateONDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.descriptorIsAggregate();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.aggregate.SwitchStateON.class);
// Inheritance properties.
descriptor.getDescriptorInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.aggregate.SwitchState.class);
// Event manager.
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class EntityTypeFromDescriptor method buildMyEntityDescriptor.
private RelationalDescriptor buildMyEntityDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(MyEntity.class);
descriptor.setTableName(TABLE_NAME);
descriptor.addPrimaryKeyFieldName("ID");
AbstractDirectMapping mapping = (AbstractDirectMapping) descriptor.addDirectMapping("id", "ID");
mapping.setAttributeClassification(int.class);
mapping = (AbstractDirectMapping) descriptor.addDirectMapping("name", "NAME");
mapping.setAttributeClassification(String.class);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ExceptionTestSaveSecurityManager method setup.
@Override
protected void setup() {
orgIntegrityChecker = getSession().getIntegrityChecker();
// moved into setup
getSession().setIntegrityChecker(new IntegrityChecker());
// moved into setup
getSession().getIntegrityChecker().dontCatchExceptions();
// security java.policy must allow full access
orgSecurityManager = System.getSecurityManager();
System.setSecurityManager(new TestSecurityManager());
orgDefaultUseDoPrivilegedValue = getOrgDefaultUseDoPrivilegedValue();
PrivilegedAccessHelper.setDefaultUseDoPrivilegedValue(true);
descriptor = new RelationalDescriptor();
descriptor.setJavaClass(getTestClass());
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class ReturningProject method buildClass1Descriptor.
public RelationalDescriptor buildClass1Descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.tests.returning.model.Class1.class);
descriptor.addTableName("RETURNING");
descriptor.addPrimaryKeyFieldName("RETURNING.ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setAlias("Class1");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping a_IntegerMapping = new DirectToFieldMapping();
a_IntegerMapping.setAttributeName("a_Integer");
a_IntegerMapping.setFieldName("RETURNING.A1");
a_IntegerMapping.readOnly();
descriptor.addMapping(a_IntegerMapping);
DirectToFieldMapping b_IntegerMapping = new DirectToFieldMapping();
b_IntegerMapping.setAttributeName("b_Integer");
b_IntegerMapping.setFieldName("RETURNING.B1");
b_IntegerMapping.readOnly();
descriptor.addMapping(b_IntegerMapping);
DirectToFieldMapping c_BigDecimalMapping = new DirectToFieldMapping();
c_BigDecimalMapping.setAttributeName("c_BigDecimal");
c_BigDecimalMapping.setFieldName("RETURNING.C1");
descriptor.addMapping(c_BigDecimalMapping);
DirectToFieldMapping c_IntegerMapping = new DirectToFieldMapping();
c_IntegerMapping.setAttributeName("c_Integer");
c_IntegerMapping.setFieldName("RETURNING.C1");
c_IntegerMapping.readOnly();
descriptor.addMapping(c_IntegerMapping);
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("RETURNING.ID");
descriptor.addMapping(idMapping);
TransformationMapping a_plus_minus_b_BigDecimalMapping = new TransformationMapping();
a_plus_minus_b_BigDecimalMapping.setAttributeName("a_plus_minus_b_BigDecimal");
a_plus_minus_b_BigDecimalMapping.setAttributeTransformation("build_a_plus_minus_b_BigDecimal");
a_plus_minus_b_BigDecimalMapping.addFieldTransformation("RETURNING.B1", "getB");
a_plus_minus_b_BigDecimalMapping.addFieldTransformation("RETURNING.A1", "getA");
descriptor.addMapping(a_plus_minus_b_BigDecimalMapping);
AggregateObjectMapping aggregateMapping = new AggregateObjectMapping();
aggregateMapping.setAttributeName("aggregate");
aggregateMapping.setReferenceClass(org.eclipse.persistence.testing.tests.returning.model.Class2.class);
aggregateMapping.setIsNullAllowed(true);
aggregateMapping.addFieldNameTranslation("RETURNING.C2", "C2");
aggregateMapping.addFieldNameTranslation("RETURNING.B2", "B2");
aggregateMapping.addFieldNameTranslation("RETURNING.A2", "A2");
descriptor.addMapping(aggregateMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class TargetInvocationWhileEventExecutionTest method setup.
@Override
protected void setup() {
descriptor = new RelationalDescriptor();
descriptor.setJavaClass(TargetInvocationWhileEventExecutionTest.class);
descriptor.addTableName("DummyTable");
eventManager = descriptor.getEventManager();
// this method throws an exception
eventManager.setPreUpdateSelector("invalidMethod");
eventManager.initialize((AbstractSession) getSession());
event = new DescriptorEvent(new TargetInvocationWhileEventExecutionTest());
event.setEventCode(DescriptorEventManager.PreUpdateEvent);
event.setDescriptor(descriptor);
event.setSession((AbstractSession) getSession());
expectedException = DescriptorException.targetInvocationWhileEventExecution("invalidMethod", descriptor, new Exception());
}
Aggregations