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 = 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);
  }
  protected void buildDefaultReadOnlyTestClassDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.models.readonly.DefaultReadOnlyTestClass.class);
    descriptor.setTableName("DEFAULT_READ_ONLY");
    descriptor.setPrimaryKeyFieldName("DEFAULT_READ_ONLY.DATA");

    org.eclipse.persistence.mappings.DirectToFieldMapping directToFieldMapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directToFieldMapping.setAttributeName("data");
    directToFieldMapping.setFieldName("DEFAULT_READ_ONLY.DATA");
    directToFieldMapping.setGetMethodName("getData");
    directToFieldMapping.setSetMethodName("setData");
    descriptor.addMapping(directToFieldMapping);

    addDescriptor(descriptor);
    addDefaultReadOnlyClass(
        org.eclipse.persistence.testing.models.readonly.DefaultReadOnlyTestClass.class);
  }
Esempio n. 8
0
  public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(Budget.class);
    descriptor.setTableName("BUDGET");
    descriptor.addPrimaryKeyFieldName("BUDGET.ID");

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberName("BUDG_SEQ");
    descriptor.setSequenceNumberFieldName("ID");

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("currency");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("BUDGET.CUR");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping2.setAttributeName("amount");
    directtofieldmapping2.setIsReadOnly(false);
    directtofieldmapping2.setFieldName("BUDGET.AMNT");
    descriptor.addMapping(directtofieldmapping2);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping3 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping3.setAttributeName("id");
    directtofieldmapping3.setIsReadOnly(false);
    directtofieldmapping3.setFieldName("BUDGET.ID");
    descriptor.addMapping(directtofieldmapping3);

    return descriptor;
  }
Esempio n. 9
0
  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;
  }