Search in sources :

Example 46 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class ConcurrentLargeProject method descriptor.

public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(ConcurrentLargeProject.class);
    descriptor.setTableName("CONCURRENT_PROJECT");
    // Inheritance Properties.
    descriptor.getInheritancePolicy().setParentClass(ConcurrentProject.class);
    OneToOneMapping supervisorMapping = new OneToOneMapping();
    supervisorMapping.setAttributeName("supervisor");
    supervisorMapping.setReferenceClass(ConcurrentPerson.class);
    supervisorMapping.setGetMethodName("getSupervisor");
    supervisorMapping.setSetMethodName("setSupervisor");
    supervisorMapping.dontUseIndirection();
    supervisorMapping.addTargetForeignKeyFieldName("CONCURRENT_EMP.PROJ_ID", "CONCURRENT_PROJECT.ID");
    descriptor.addMapping(supervisorMapping);
    OneToOneMapping locationMapping = new OneToOneMapping();
    locationMapping.setAttributeName("location");
    locationMapping.setReferenceClass(ConcurrentAddress.class);
    locationMapping.setGetMethodName("getLocation");
    locationMapping.setSetMethodName("setLocation");
    locationMapping.dontUseIndirection();
    locationMapping.addForeignKeyFieldName("CONCURRENT_PROJECT.LOCATION_ID", "CONCURRENT_ADDRESS.ADDRESS_ID");
    descriptor.addMapping(locationMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) OneToOneMapping(org.eclipse.persistence.mappings.OneToOneMapping)

Example 47 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class BooleanTester method descriptorWithAccessors.

public static RelationalDescriptor descriptorWithAccessors() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(BooleanTester.class);
    descriptor.setTableName("BOOLEANS");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    try {
        descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
        descriptor.addDirectMapping("booleanValue", "getBooleanValue", "setBooleanValue", "BOOLEANV");
        descriptor.addDirectMapping("booleanClassValue", "getBooleanClassValue", "setBooleanClassValue", "BOOLEANC");
    } catch (DescriptorException exception) {
    }
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 48 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class CLOBTester method descriptor.

public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(CLOBTester.class);
    descriptor.setTableName("CLOBS");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
    descriptor.addDirectMapping("longString", "THECLOB");
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 49 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class TimeDateTester method descriptorWithAccessors.

public static RelationalDescriptor descriptorWithAccessors() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(TimeDateTester.class);
    descriptor.setTableName("TIMEDATE");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
    descriptor.addDirectMapping("utilDate", "getUtilDate", "setUtilDate", "UTILDATE");
    descriptor.addDirectMapping("sqlDate", "getSQLDate", "setSQLDate", "SQLDATE");
    descriptor.addDirectMapping("time", "getTime", "setTime", "TTIME");
    descriptor.addDirectMapping("timestamp", "getTimestamp", "setTimestamp", "TSTAMP");
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 50 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class TimeDateTester method descriptor.

public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(TimeDateTester.class);
    descriptor.setTableName("TIMEDATE");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
    descriptor.addDirectMapping("utilDate", "UTILDATE");
    descriptor.addDirectMapping("sqlDate", "SQLDATE");
    descriptor.addDirectMapping("time", "TTIME");
    descriptor.addDirectMapping("timestamp", "TSTAMP");
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

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