public static RelationalDescriptor descriptor() { 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. */ descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME"); descriptor.addDirectMapping("booleanValue", "BOOLEANV"); descriptor.addDirectMapping("booleanClassValue", "BOOLEANC"); return descriptor; }
protected void buildHollywoodAgentDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(HollywoodAgent.class); descriptor.setTableName("HOLLYWOODAGENT"); descriptor.addPrimaryKeyFieldName("HOLLYWOODAGENT_ID"); descriptor.setSequenceNumberName("HOLLYWOODAGENT_SEQ"); descriptor.setSequenceNumberFieldName("HOLLYWOODAGENT_ID"); descriptor.addDirectMapping("id", "HOLLYWOODAGENT_ID"); descriptor.addDirectMapping("name", "NAME"); descriptor.addDirectMapping("numberOfConnections", "CONNECTIONS"); addDescriptor(descriptor); }
protected void buildCharityDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(Charity.class); descriptor.setTableName("CHARITY"); descriptor.addPrimaryKeyFieldName("CHARITY_ID"); descriptor.setSequenceNumberName("CHARITY_SEQ"); descriptor.setSequenceNumberFieldName("CHARITY_ID"); descriptor.addDirectMapping("id", "CHARITY_ID"); descriptor.addDirectMapping("name", "NAME"); descriptor.addDirectMapping("donationsRaised", "DONATIONS_RAISED"); addDescriptor(descriptor); }
protected void buildReadOnlyHollywoodAgentDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(ReadOnlyHollywoodAgent.class); descriptor.setTableName("HOLLYWOODAGENT"); descriptor.addPrimaryKeyFieldName("HOLLYWOODAGENT_ID"); descriptor.setSequenceNumberName("HOLLYWOODAGENT_SEQ"); descriptor.setSequenceNumberFieldName("HOLLYWOODAGENT_ID"); descriptor.addDirectMapping("id", "HOLLYWOODAGENT_ID"); descriptor.addDirectMapping("name", "NAME"); addDescriptor(descriptor); addDefaultReadOnlyClass(ReadOnlyHollywoodAgent.class); }
protected void buildReadOnlyCharityDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(ReadOnlyCharity.class); descriptor.setTableName("CHARITY"); descriptor.addPrimaryKeyFieldName("CHARITY_ID"); descriptor.setSequenceNumberName("CHARITY_SEQ"); descriptor.setSequenceNumberFieldName("CHARITY_ID"); descriptor.addDirectMapping("id", "CHARITY_ID"); descriptor.addDirectMapping("name", "NAME"); descriptor.setShouldBeReadOnly(true); addDescriptor(descriptor); }
private static RelationalDescriptor commonDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.setJavaClass(CalendarToTSTZWithBindingTest.class); descriptor.setTableName("CALENDARTOTSTZ_BINDING"); descriptor.setPrimaryKeyFieldName("TEST_ID"); descriptor.addDirectMapping("testId", "getTestId", "setTestId", "TEST_ID"); return descriptor; }
public static RelationalDescriptor descriptor() { RelationalDescriptor descriptor = commonDescriptor(); descriptor.addDirectMapping("calendar", "TSTZ_DATA"); return descriptor; }
public static RelationalDescriptor descriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); /* First define the class, table and descriptor properties. */ descriptor.setJavaClass(Customer.class); descriptor.setTableName("EVENTCUSTOMER"); descriptor.setPrimaryKeyFieldName("ID"); descriptor.setSequenceNumberName("SEQ"); descriptor.setSequenceNumberFieldName("ID"); /* Next define the attribute mappings. */ OneToOneMapping addressMapping = new OneToOneMapping(); addressMapping.setAttributeName("address"); addressMapping.setReferenceClass(Address.class); addressMapping.dontUseIndirection(); addressMapping.privateOwnedRelationship(); addressMapping.addForeignKeyFieldName("EVENTCUSTOMER.ADDRESS_ID", "EADDRESS.ID"); descriptor.addMapping(addressMapping); OneToOneMapping phoneMapping = new OneToOneMapping(); phoneMapping.setAttributeName("phoneNumber"); phoneMapping.setReferenceClass(Phone.class); phoneMapping.dontUseIndirection(); phoneMapping.privateOwnedRelationship(); phoneMapping.addForeignKeyFieldName("EVENTCUSTOMER.PHONE_ID", "EPHONE.ID"); descriptor.addMapping(phoneMapping); OneToOneMapping emailMapping = new OneToOneMapping(); emailMapping.setAttributeName("email"); emailMapping.setReferenceClass(EmailAccount.class); emailMapping.dontUseIndirection(); emailMapping.privateOwnedRelationship(); emailMapping.addForeignKeyFieldName("EVENTCUSTOMER.EMAIL_ID", "EMAILACC.ID"); descriptor.addMapping(emailMapping); DirectCollectionMapping associationsMapping = new DirectCollectionMapping(); associationsMapping.setAttributeName("associations"); associationsMapping.dontUseIndirection(); associationsMapping.setReferenceTableName("EASSOCIATIONS"); associationsMapping.setDirectFieldName("EASSOCIATIONS.DESCRIP"); associationsMapping.addReferenceKeyFieldName("EASSOCIATIONS.CUSTOMER_ID", "EVENTCUSTOMER.ID"); descriptor.addMapping(associationsMapping); OneToManyMapping ordersMapping = new OneToManyMapping(); ordersMapping.setAttributeName("orders"); ordersMapping.setReferenceClass(Order.class); ordersMapping.useBasicIndirection(); ordersMapping.addTargetForeignKeyFieldName("EVENTORDER.CUSTOMER_ID", "EVENTCUSTOMER.ID"); descriptor.addMapping(ordersMapping); AggregateObjectMapping creditMapping = new AggregateObjectMapping(); creditMapping.setAttributeName("creditCard"); creditMapping.setReferenceClass(org.eclipse.persistence.testing.models.events.CreditCard.class); creditMapping.setIsNullAllowed(true); descriptor.addMapping(creditMapping); descriptor.addDirectMapping("id", "ID"); descriptor.addDirectMapping("name", "NAME"); return descriptor; }