protected void setup() {
   descriptor = new RelationalDescriptor();
   descriptor.setJavaClass(TargetInvocationWhileEventExecutionTest.class);
   descriptor.addTableName("DummyTable");
   eventManager = descriptor.getEventManager();
   eventManager.setPreUpdateSelector("invalidMethod"); // this method throws an exception
   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());
 }
Example #2
0
  public static ClassDescriptor descriptor() {
    ClassDescriptor descriptor = new ClassDescriptor();

    descriptor.setJavaClass(Promoter.class);
    descriptor.setTableName("RO_PROMO");
    descriptor.addPrimaryKeyFieldName("PROMO_ID");
    descriptor.setSequenceNumberName("PROMO_SEQ");
    descriptor.setSequenceNumberFieldName("PROMO_ID");

    descriptor.addDirectMapping("id", "PROMO_ID");
    descriptor.addDirectMapping("name", "NAME");
    /*
    	// The promoter operates in a collection of countries.
    	org.eclipse.persistence.mappings.OneToManyMapping phoneNumbersMapping = new org.eclipse.persistence.mappings.OneToManyMapping() ;
    	phoneNumbersMapping.setAttributeName("phoneNumbers");
    	phoneNumbersMapping.setReferenceClass(PhoneNumber.class);
    	phoneNumbersMapping.setTargetForeignKeyFieldName("PROMO_ID");
    	phoneNumbersMapping.privateOwnedRelationship();
    //	phoneNumbersMapping.dontUseIndirection();
    	descriptor.addMapping(phoneNumbersMapping);
    */

    return descriptor;
  }