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; }
public RelationalDescriptor buildImageDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(org.eclipse.persistence.testing.tests.lob.Image.class); descriptor.addTableName("IMAGE"); descriptor.addTableName("CLIP"); descriptor.addPrimaryKeyFieldName("IMAGE.ID"); // Descriptor properties. descriptor.useSoftCacheWeakIdentityMap(); descriptor.setIdentityMapSize(100); descriptor.useRemoteSoftCacheWeakIdentityMap(); descriptor.setRemoteIdentityMapSize(100); descriptor.setSequenceNumberFieldName("IMAGE.ID"); descriptor.setSequenceNumberName("image_lob_seq"); descriptor.setAlias("Image"); // Query manager. descriptor.getQueryManager().checkCacheForDoesExist(); // Named Queries // Event manager. // Mappings. DirectToFieldMapping idMapping = new DirectToFieldMapping(); idMapping.setAttributeName("id"); idMapping.setFieldName("IMAGE.ID"); descriptor.addMapping(idMapping); DirectToFieldMapping pictureMapping = new DirectToFieldMapping(); pictureMapping.setAttributeName("picture"); pictureMapping.setFieldName("IMAGE.PICTURE"); pictureMapping.setFieldClassification(java.sql.Blob.class); descriptor.addMapping(pictureMapping); DirectToFieldMapping scriptMapping = new DirectToFieldMapping(); scriptMapping.setAttributeName("script"); scriptMapping.setFieldName("IMAGE.SCRIPT"); scriptMapping.setFieldClassification(java.sql.Clob.class); descriptor.addMapping(scriptMapping); DirectToFieldMapping audioMapping = new DirectToFieldMapping(); audioMapping.setAttributeName("audio"); audioMapping.setFieldName("CLIP.AUDIO"); audioMapping.setFieldClassification(java.sql.Blob.class); descriptor.addMapping(audioMapping); DirectToFieldMapping commentaryMapping = new DirectToFieldMapping(); commentaryMapping.setAttributeName("commentary"); commentaryMapping.setFieldName("CLIP.COMMENTARY"); commentaryMapping.setFieldClassification(java.sql.Clob.class); descriptor.addMapping(commentaryMapping); return descriptor; }
public RelationalDescriptor descriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.domain.Employee.class); descriptor.addTableName("EMPLOYEE"); descriptor.addPrimaryKeyFieldName("EMPLOYEE.EMP_ID"); // Descriptor properties. descriptor.useFullIdentityMap(); descriptor.setIdentityMapSize(100); descriptor.useRemoteFullIdentityMap(); descriptor.setRemoteIdentityMapSize(100); descriptor.setSequenceNumberFieldName("EMP_ID"); descriptor.setSequenceNumberName("EMP_SEQ"); // the following causes the correct error to occure. descriptor.setExistenceChecking("Check Bash"); DirectToFieldMapping idMapping = new DirectToFieldMapping(); idMapping.setAttributeName("id"); idMapping.setFieldName("EMPLOYEE.EMP_ID"); descriptor.addMapping(idMapping); return descriptor; }
public ClassDescriptor buildPojoEmployeeDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass( org.eclipse.persistence.testing.tests.simplepojoclient.PojoEmployee.class); descriptor.addTableName("POJO_EMPLOYEE"); descriptor.addPrimaryKeyFieldName("POJO_EMPLOYEE.EMP_ID"); // Descriptor Properties. descriptor.useSoftCacheWeakIdentityMap(); descriptor.setIdentityMapSize(100); descriptor.useRemoteSoftCacheWeakIdentityMap(); descriptor.setRemoteIdentityMapSize(100); descriptor.setAlias("PojoEmployee"); // Query Manager. descriptor.getQueryManager().checkCacheForDoesExist(); // Event Manager. // Mappings. DirectToFieldMapping empIdMapping = new DirectToFieldMapping(); empIdMapping.setAttributeName("empId"); empIdMapping.setGetMethodName("getEmpId"); empIdMapping.setSetMethodName("setEmpId"); empIdMapping.setFieldName("POJO_EMPLOYEE.EMP_ID"); descriptor.addMapping(empIdMapping); DirectToFieldMapping fNameMapping = new DirectToFieldMapping(); fNameMapping.setAttributeName("fName"); fNameMapping.setGetMethodName("getFName"); fNameMapping.setSetMethodName("setFName"); fNameMapping.setFieldName("POJO_EMPLOYEE.F_NAME"); descriptor.addMapping(fNameMapping); DirectToFieldMapping genderMapping = new DirectToFieldMapping(); genderMapping.setAttributeName("gender"); genderMapping.setGetMethodName("getGender"); genderMapping.setSetMethodName("setGender"); genderMapping.setFieldName("POJO_EMPLOYEE.GENDER"); ObjectTypeConverter genderMappingConverter = new ObjectTypeConverter(); genderMappingConverter.addConversionValue(new Character('F'), "Female"); genderMappingConverter.addConversionValue(new Character('M'), "Male"); genderMapping.setConverter(genderMappingConverter); descriptor.addMapping(genderMapping); DirectToFieldMapping lNameMapping = new DirectToFieldMapping(); lNameMapping.setAttributeName("lName"); lNameMapping.setGetMethodName("getLName"); lNameMapping.setSetMethodName("setLName"); lNameMapping.setFieldName("POJO_EMPLOYEE.L_NAME"); descriptor.addMapping(lNameMapping); DirectToFieldMapping managerIdMapping = new DirectToFieldMapping(); managerIdMapping.setAttributeName("managerId"); managerIdMapping.setGetMethodName("getManagerId"); managerIdMapping.setSetMethodName("setManagerId"); managerIdMapping.setFieldName("POJO_EMPLOYEE.MANAGER_ID"); descriptor.addMapping(managerIdMapping); return descriptor; }
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); /* DirectToFieldMapping nameMapping = new DirectToFieldMapping(); nameMapping.setAttributeName("name"); nameMapping.setFieldName("PROJECT.PROJ_NAME"); nameMapping.setNullValue(""); descriptor.addMapping(nameMapping); */ /* 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; }