File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not map discriminator value

 
eion martin
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have an inheritance relationship configured for attributes of a product.

@Entity(name="AbstractFlexAttribute")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@Table(name="flex_attribute_value_master")
@DiscriminatorColumn(name="ATTRIBUTE_NM", discriminatorType=DiscriminatorType.STRING)

public abstract class AbstractFlexAttribute {

}


@Entity(name="DistributionFlexAttribute")
@DiscriminatorValue("RETAIL_COMMERCIAL_IND")
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)
@JoinTable(
name = "PROD_GRP_FLEX_ATTR_MAPPING",
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: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic