Platinum Partner

No Subclass Matches This Class; for This Aggregate Mapping With Inheritance

No subclass matches this class [class com.baselogic.test.CustomerFixture$2$1] for this Aggregate mapping with inheritance. I have been writing a chapter for my new book “Java EE6 Cookbook for Securing, Tuning and Extending Enterprise applications” today, and I ran across an interesting error based on a JPA testing pattern.

I have used 2 patterns for seeding data to test some @CollectionTable functionality.
First, I used DBUnit to seed my data, and that seems to work just fine for adding @CollectionTable relationships.

The second seemed fairly straight forward. I wanted to create a Fixture utility to create an entity to insert

Customer customer = CustomerFixture.createSingleCustomer();

My CustomerFixture.createSingleCustomer() is fairly simple

public static Customer createSingleCustomer() {
Customer customer = new Customer();
customer.setDescription("Customer with an Android Device.");
new HashSet<String>() {{
return customer;


I was adding Address’s that looked like this

public static Map<String, Address> createAddresses() {
final int pk = getRandomInt(1, 999);
return new HashMap<String, Address>() {{
put(String.format("%03d", pk),
new Address(){{
setStreet("123 Main Street");
setCity("San Francisco");

Notice that I created the Address with a default constructor…?

When running this, I get a very interesting exception:

Exception Description: No subclass matches this class [class com.baselogic.test.CustomerFixture$2$1] for this Aggregate mapping with inheritance.
Mapping: org.eclipse.persistence.mappings.AggregateCollectionMapping[addresses]
Descriptor: RelationalDescriptor(com.baselogic.chapter02.Customer --> [DatabaseTable(CUSTOMER)])

What I finally tracked this down to was from skimming the XXX codes on

ECLIPSELINK-00068: The value of an aggregate in object [{0}] is null. Null values not allowed for Aggregate mappings unless “Allow Null” is specified.
Cause: The value of the aggregate in the source object object is null. Null values are not allowed for aggregate mappings unless allow null is specified in the aggregate mapping.
Action: Call the mapping method allowNull. Provide parameters only if you are making a distinction between foo() and foo(integer).

Specifically the ‘Action’.
So I started looking at my Fixture, and constructed my Address with a specific Constructor:

public static Map<String, Address> createAddresses(){
final int pk = getRandomInt(1, 999);
return new HashMap<String, Address>(){{
put(String.format("%03d", pk),
new Address(
"123 Main Street",
"San Francisco",

This solved the issue, and the seeding of the Customer succeeded.


{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ }}
{{ parent.authors[0].realName ||}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks