Search in sources :

Example 96 with RelationalDescriptor

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;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 97 with RelationalDescriptor

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;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) AbstractDirectMapping(org.eclipse.persistence.mappings.foundation.AbstractDirectMapping)

Example 98 with RelationalDescriptor

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());
}
Also used : IntegrityChecker(org.eclipse.persistence.exceptions.IntegrityChecker) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 99 with RelationalDescriptor

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;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 100 with RelationalDescriptor

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());
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) DescriptorEvent(org.eclipse.persistence.descriptors.DescriptorEvent) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException)

Aggregations

RelationalDescriptor (org.eclipse.persistence.descriptors.RelationalDescriptor)306 DirectToFieldMapping (org.eclipse.persistence.mappings.DirectToFieldMapping)122 OneToOneMapping (org.eclipse.persistence.mappings.OneToOneMapping)43 EclipseLinkException (org.eclipse.persistence.exceptions.EclipseLinkException)26 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)19 OneToManyMapping (org.eclipse.persistence.mappings.OneToManyMapping)18 Vector (java.util.Vector)17 TransparentIndirectionPolicy (org.eclipse.persistence.internal.indirection.TransparentIndirectionPolicy)15 MappedKeyMapContainerPolicy (org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy)15 TransformationMapping (org.eclipse.persistence.mappings.TransformationMapping)13 IntegrityChecker (org.eclipse.persistence.exceptions.IntegrityChecker)12 ManyToManyMapping (org.eclipse.persistence.mappings.ManyToManyMapping)10 java.util (java.util)9 AggregateObjectMapping (org.eclipse.persistence.mappings.AggregateObjectMapping)8 org.eclipse.persistence.mappings (org.eclipse.persistence.mappings)7 UnidirectionalOneToManyMapping (org.eclipse.persistence.mappings.UnidirectionalOneToManyMapping)6 ObjectTypeConverter (org.eclipse.persistence.mappings.converters.ObjectTypeConverter)6 DatabaseRecord (org.eclipse.persistence.sessions.DatabaseRecord)6 DirectCollectionMapping (org.eclipse.persistence.mappings.DirectCollectionMapping)5 DirectMapMapping (org.eclipse.persistence.mappings.DirectMapMapping)4