2

This simple SINGLE_TABLE inheritance hierarchy somehow fails when my application tries to access the inheriting entity RootFolderNode.

The entities are defined as dynamic entities access="VIRTUAL", without a Java class backing. The PersistenceUnit is loaded without any complaints.

Exception Description: Problem compiling 
    [SELECT DISTINCT e FROM RootFolderNode e WHERE  e.id =  :param1 ]. 
[46, 50] The state field path 'e.id' cannot be resolved to a valid type.

The relevant part of the ORM.xml

<entity class="FolderNode" access="VIRTUAL" >
    <table name="FOLDER_NODE_PREPARE" />
    <inheritance strategy="SINGLE_TABLE"/>
    <discriminator-value>F</discriminator-value>
    <attributes>
        <id name="id" attribute-type="Long">
            <column name="id" />
            <generated-value strategy="SEQUENCE" generator="FOLDER_NODE_SEQ" />
            <sequence-generator sequence-name="FOLDER_NODE_SEQ" name="FOLDER_NODE_SEQ" allocation-size="1" />
        </id>
        ...
    </attributes>
</entity>

<entity class="RootFolderNode" parent-class="FolderNode" access="VIRTUAL">
    <discriminator-value>R</discriminator-value>
</entity>

What am I missing here?

Products in use: EclipseLink 2.5.1. JBoss EAP 6.2.

leo
  • 3,528
  • 3
  • 20
  • 19

2 Answers2

1

Solution: Repeat inheritance specification:

<entity class="RootFolderNode" parent-class="FolderNode" access="VIRTUAL">
    <inheritance strategy="SINGLE_TABLE"/>
    <discriminator-value>R</discriminator-value>
</entity>
leo
  • 3,528
  • 3
  • 20
  • 19
0

you should use inheritance strategy to overcome this.please add the following line in your RootFolderNode.

 <inheritance strategy="SINGLE_TABLE"/>
TanvirChowdhury
  • 2,498
  • 23
  • 28