Using the annotation @Inheritance(strategy = InheritanceType.JOINED) causes a ClassCastException in JBoss

Solution Verified - Updated -

Issue

I have a pojo named Incident,

@Entity
@Inheritance(strategy = InheritanceType,JOINED)
@Table(name = "TBLINCIDENT")@EntityListeners(IncidentListener,class)
@Indexed@NamedQuery(name = "Incident,changeRestrictedStatus", query = "Update Incident set bsar = :status where id = :incidentId")
public class Incident extends BaseDataType implements Serializable {@Column(name = "BSAR")
public Boolean getSar()
{
    return this,sar;
}

I have another pojo which extends this pojo named AccidentReport

@Entity
@Table(name = "TBLACCIDENTREPORT")
public class AccidentReport extends Incident{

Using the InheritanceType,JOINED will cause the jboss server to raise the following error on start up,

Error installing to Start: name=persistence,unit:unitName=#care state=Create
java,lang,ClassCastException: org,hibernate,hql,ast,tree,IdentNode cannot be cast to org,hibernate,hql,ast,tree,DotNode
 at org,hibernate,hql,ast,tree,AssignmentSpecification,<init>(AssignmentSpecification,java:72)
 at org,hibernate,hql,ast,HqlSqlWalker,evaluateAssignment(HqlSqlWalker,java:1051)
 at org,hibernate,hql,ast,HqlSqlWalker,evaluateAssignment(HqlSqlWalker,java:1045)
 at org,hibernate,hql,antlr,HqlSqlBaseWalker,assignment(HqlSqlBaseWalker,java:1086)
 at org,hibernate,hql,antlr,HqlSqlBaseWalker,setClause(HqlSqlBaseWalker,java:766)
 at org,hibernate,hql,antlr,HqlSqlBaseWalker,updateStatement(HqlSqlBaseWalker,java:361)
 at org,hibernate,hql,antlr,HqlSqlBaseWalker,statement(HqlSqlBaseWalker,java:239)
 at org,hibernate,hql,ast,QueryTranslatorImpl,analyze(QueryTranslatorImpl,java:254)
 at org,hibernate,hql,ast,QueryTranslatorImpl,doCompile(QueryTranslatorImpl,java:185)
 at org,hibernate,hql,ast,QueryTranslatorImpl,compile(QueryTranslatorImpl,java:136)
 at org,hibernate,engine,query,HQLQueryPlan,<init>(HQLQueryPlan,java:101)
 at org,hibernate,engine,query,HQLQueryPlan,<init>(HQLQueryPlan,java:80)
 at org,hibernate,engine,query,QueryPlanCache,getHQLQueryPlan(QueryPlanCache,java:98)
 at org,hibernate,impl,SessionFactoryImpl,checkNamedQueries(SessionFactoryImpl,java:483)
 at org,hibernate,impl,SessionFactoryImpl,<init>(SessionFactoryImpl,java:393)
 at org,hibernate,cfg,Configuration,buildSessionFactory(Configuration,java:1341)

Environment

  • JBoss Enterprise Application Platform (EAP) 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In