Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Some Discriminator Values cause problem, while others do not(Error with some values in the @DiscriminatorColumn column, but not others)
Some Discriminator Values cause problem, while others do not [message #820175] Tue, 13 March 2012 20:29 Go to next message
Matt Looman is currently offline Matt LoomanFriend
Messages: 3
Registered: March 2012
Junior Member
I get the following message for only one value of the discriminator column in my inheritance structure. "Exception Description: Missing class for indicator field value [01ce19bf-46ca-11e1-9fb5-00059a3c7a00] of type [class java.lang.String]."

The problem only occurs when I include rows for the Summary class (the indicator value above). When I remove those rows from the table, the code works.

The discriminator column is a CHAR(36), but there are never any spaces. So, I don't think that's the problem.

I have a Mapped Superclass "Activity" that divides into two entities using TABLE_PER_CLASS strategy. Each of the tables "Performance" and "Plan" then further divide using "SINGLE_TABLE" strategy. The Plan table is subclassed as shown below.

Activity <-- Performance
Activity <-- Plan
Activity <-- Plan <-- Project
Activity <-- Plan <-- Project <-- Opportunity
Activity <-- Plan <-- Summary
Activity <-- Plan <-- WorkItem
Activity <-- Plan <-- WorkItem <-- Calendar
Activity <-- Plan <-- WorkItem <-- Task
Activity <-- Plan <-- WorkItem <-- Travel

The only thing that is possibly unique to the Summary class is it doesn't have any additional attributes/columns from Plan.

I've attached a file with the Plan table definition and the class definitions for Activity, Plan, Project, WorkItem and Summary. Setter/Getter methods and constructors have been removed to shorten the file.

Any help is appreciated greatly!!!!!!!!

Versions:
JPA: EclipseLink 2.2
DB: MySQL 5.5
System: Windows 7-64bit
Java: 1.6.0_25
IDE: NetBeans IDE 7.0.1
Re: Some Discriminator Values cause problem, while others do not [message #825207 is a reply to message #820175] Tue, 20 March 2012 15:52 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I'm not sure that you can change the inheritance type in subclasses, so that could be the root of your issue.
You also cannot use @Inheritance in a @MappedSuperclass, so that doesn't make sense.
Also the @DiscriminatorColumn, @Table and @Inheritance can only be given in the root entity.
If this is working at all, my guess is that the @Inheritance in the @MappedSuperclass is being ignored.
Check that the indicator is correct in Summary, looks like you may have typed it in wrong.


James : Wiki : Book : Blog : Twitter
Re: Some Discriminator Values cause problem, while others do not [message #825517 is a reply to message #825207] Tue, 20 March 2012 23:39 Go to previous messageGo to next message
Matt Looman is currently offline Matt LoomanFriend
Messages: 3
Registered: March 2012
Junior Member
Thank you for the advice on @MappedSuperclass and @Inheritance. I had found references that said EclipseLink supports mixed inheritance, but I can't find the reference again.

I have checked and rechecked the value of the discriminator column; even copying the value from the log into the java code.

I also tried adding a column/attribute unique to the Summary class, but that hasn't changed the behavior at all.

So far, I am still getting the same exception ([EclipseLink-43])

As an alternative, can anyone tell me where to put a try-catch block, so I can handle this exception gracefully, rather than have it crash my application?
Re: [UPDATE] Some Discriminator Values cause problem, while others do not [message #826977 is a reply to message #825517] Thu, 22 March 2012 18:41 Go to previous messageGo to next message
Matt Looman is currently offline Matt LoomanFriend
Messages: 3
Registered: March 2012
Junior Member
I tried the following with the indicated results:

Change: Created new class, "ActivityGroup" to replace "Summary", including changing the Discriminator value.
Result: Same problem resulted for the rows that should have been allocated to the "ActivityGroup"

Change: Restored the "Summary" class. Changed the values for the underlying data rows to match the discriminator value for the "Plan" class. ("Plan" is the parent class of "Summary")
Result: This corrected the problem. For now, this is a viable workaround.

From the above, it would seem that the problem is in the "Summary" class definition. It's code is provided below.


package org.pims.data;

import java.sql.Date;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

/**
 *
 * @author mlooman
 * @version 0.0
 *
 * CHANGES:
 *  Date          Version      Description
 * -------------- ----------- ---------------------------------------------------
 *  Mar 22, 2012   0.0         Initial Implementation
 */
@Entity
@DiscriminatorValue("cc113aa4-742d-11e1-b5f9-00059a3c7a00")
public class Summary extends Plan {
  //<editor-fold defaultstate="collapsed" desc="Constructors"
  public Summary(){
    super();
  }
    public Summary(String entityIdentifier){
    super(entityIdentifier);
  }

  public Summary(String entityIdentifier, int planNumber, int activitySequenceInParentOrdinal, String planCurrentState, String planCurrentReason, Date planCreationTimestamp) {
    super(entityIdentifier, planNumber, activitySequenceInParentOrdinal, planCurrentState, planCurrentReason, planCreationTimestamp);
  }
  //</editor-fold>

}
Re: [UPDATE] Some Discriminator Values cause problem, while others do not [message #827635 is a reply to message #826977] Fri, 23 March 2012 15:45 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Try adding a field to the Plan table and map it only in Summary to see if the problem goes away. If it does, file a bug with a simple test case so it can be looked into further and fixed.
Previous Topic:RESOLVED: retrieving some fields from an Entity
Next Topic:Persistence.getPersistenceUtil
Goto Forum:
  


Current Time: Fri Apr 26 09:37:34 GMT 2024

Powered by FUDForum. Page generated in 0.03595 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top