My Oracle Support Banner

ORA-00904 When Executing Query On Entity Model Using Mixed Inheritance Strategy (Doc ID 1142543.1)

Last updated on MARCH 26, 2019

Applies to:

Oracle TopLink - Version 11.1.1.0.1 to 11.1.1.2.0 [Release Oracle11g]
Information in this document applies to any platform.
***Checked for relevance on 08-Mar-2013***

Symptoms

Entity Object Model

Project (strategy="joined", discrimanator-column="EMP_TYPE")
largeProject extends Project (strategy="SINGLE_TABLE)
smallProject extends Project (strategy="joined" <default>)
FullTimeProject extends largeProject (strategy="joined" <default>)
PartTimeProject extends largeProject (strategy="joined" <default>)

Problem Scenario

 

 

public static void main(String[] args) {
    EntityManagerFactory emf =
    Persistence.createEntityManagerFactory("MultipleTablesInheritance");

    EntityManager em = emf.createEntityManager();

    List<Project> emps = (List<Project>)
        em.createQuery("Select e FROM Project e").getResultList();

    for (Project emp : emps) {
        System.out.println(emp.toString());
    }

    List<smallProject> contractEmps = (List<smallProject>)
        em.createQuery("Select e FROM smallProject e").getResultList();

    for (smallProject emp : contractEmps) {
        System.out.println(emp.toString());
    }

    em.close();
    emf.close();
}

 

Observed Behavior

 

[EL Fine]: 2010-01-21 14:41:46.187--ServerSession(7756310)--Connection(20914447)--Thread(Thread[main,5,main])--SELECT t0.ID, t0.project_TYPE, t0.S_DATE, t0.NAME, t1.ID, t2.project_INFO_ID, t2.ID, t2.VACATION, t2.DEPT_ID, t2.SALARY, t2.PENSION FROM project t0, project_INFO t2, largeProject t1 WHERE (((t2.ID = t0.ID) AND ((t1.ID = t2.project_INFO_ID) AND (t1.ID = t0.ID))) AND (t0.project_TYPE = ?))
bind => [2]
[EL Fine]: 2010-01-21 14:41:46.234--ServerSession(7756310)--Thread(Thread[main,5,main])--SELECT 1 FROM DUAL
[EL Warning]: 2010-01-21 14:41:46.25--UnitOfWork(25966201)--Thread(Thread[main,5,main])--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00904: "T2"."ID": invalid identifier

Error Code: 904
Call: SELECT t0.ID, t0.project_TYPE, t0.S_DATE, t0.NAME, t1.ID, t2.project_INFO_ID, t2.ID, t2.VACATION, t2.DEPT_ID, t2.SALARY, t2.PENSION FROM project t0, project_INFO t2, largeProject t1 WHERE (((t2.ID = t0.ID) AND ((t1.ID = t2.project_INFO_ID) AND (t1.ID = t0.ID))) AND (t0.project_TYPE = ?))
bind => [2]
Query: ReadAllQuery(referenceClass=Project sql="SELECT DISTINCT project_TYPE FROM project")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:685)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:528)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:529)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:262)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:599)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromConcreteTable(ExpressionQueryMechanism.java:2509)
at org.eclipse.persistence.descriptors.InheritancePolicy.selectAllRowUsingDefaultMultipleTableSubclassRead(InheritancePolicy.java:1279)
at org.eclipse.persistence.descriptors.InheritancePolicy.selectAllRowUsingMultipleTableSubclassRead(InheritancePolicy.java:1313)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2474)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:455)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2858)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:420)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:636)
at examples.tester.EntityTester.main(EntityTester.java:21)
Caused by: java.sql.SQLException: ORA-00904: "T2"."ID": invalid identifier

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:890)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:600)
... 23 more

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
 Entity Object Model
 Problem Scenario
 Observed Behavior
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.