File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Could not map discriminator value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Could not map discriminator value " Watch "Could not map discriminator value " New topic

Could not map discriminator value

eion martin

Joined: May 01, 2013
Posts: 1
I have an inheritance relationship configured for attributes of a product.

@DiscriminatorColumn(name="ATTRIBUTE_NM", discriminatorType=DiscriminatorType.STRING)

public abstract class AbstractFlexAttribute {


public class DistributionFlexAttribute extends AbstractFlexAttribute {

//~--- methods ------------------------------------------------------------


In order to retrieve retail-commercial data relevant to a product we have used a jointable in the product class.

@OneToMany(fetch = FetchType.EAGER)
joinColumns = { @JoinColumn(name = "PROD_GROUP_ID") },
inverseJoinColumns = { @JoinColumn(name = "ATTRIBUTE_VALUE_ID") }

public Collection<DistributionFlexAttribute> getDistributionFlexAttributes() {
return distributionFlexAttributes;

This was working as expected until an additional attribute type was added to the flex attribute table. Pages began to not render and the following error message was found in the logs:

Could not map discriminator value "BIOPREFERRED_CONTENT" to any known subclasses of the requested class "com.usg.model.pir.AbstractFlexAttribute" (known discriminator values: [AbstractFlexAttribute, RETAIL_COMMERCIAL_IND]).

Is there a way to avoid this error as I cannot be sure that the business will not add additional attributes in the future? It seems that a warning may be more appropriate.

I am using version 1.2.3 as called for in our pom file.
I agree. Here's the link:
subject: Could not map discriminator value
It's not a secret anymore!