| Some Discriminator Values cause problem, while others do not [message #820175] |
Tue, 13 March 2012 16:29  |
Matt Looman 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 11:52   |
James Sutherland Messages: 1844 Registered: July 2009 |
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
|
|
|
|
| Re: [UPDATE] Some Discriminator Values cause problem, while others do not [message #826977 is a reply to message #825517] |
Thu, 22 March 2012 14:41   |
Matt Looman 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>
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03043 seconds