Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Re: [eclipselink-users] Problem with Multipletables in eclispelink.

Hi Development team,

      I am able to resolve the following problem by commenting the following part of the initializeMultipleTablePrimaryKeyFields method in ClassDescriptor file of eclipselink source code.   Could you please let me know why the following portion is giving the problem by generating  unnecessary joins to the generated query.. You can find the runtime xmls and table creation scripts in the previous mail to user group.   Please let me know commenting the following code will give any problems..


 /*else {
                // If the user has specified a custom multiple table join then we do not assume that the secondary tables have identically named pk as the primary table.
                // No additional fk info was specified so assume the pk field(s) are the named the same in the additional table.
                Map newKeyMapping = new HashMap(getPrimaryKeyFields().size() + 1);
                getAdditionalTablePrimaryKeyFields().put(table, newKeyMapping);

                // For each primary key field in the primary table, add a pk relationship from the primary table's pk field to the assumed identically named secondary pk field.
                List primaryKeyFields = getPrimaryKeyFields();
                for (int pkIndex = 0; pkIndex < primaryKeyFields.size(); pkIndex++) {
                    DatabaseField primaryKeyField = (DatabaseField)primaryKeyFields.get(pkIndex);
                    DatabaseField secondaryKeyField = (DatabaseField)primaryKeyField.clone();
                    secondaryKeyField.setTable(table);
                    newKeyMapping.put(primaryKeyField, secondaryKeyField);
                    // Must add this field to read, so translations work on database row.
                    getFields().addElement(secondaryKeyField);

                    if (!getQueryManager().hasCustomMultipleTableJoinExpression()) {
                        _expression_ keyJoinExpression = builder.getField(secondaryKeyField).equal(builder.getField(primaryKeyField));
                        joinExpression = keyJoinExpression.and(joinExpression);

                        getQueryManager().getTablesJoinExpressions().put(table, keyJoinExpression);
                        if(isChild) {
                            getInheritancePolicy().addChildTableJoinExpressionToAllParents(table, keyJoinExpression);
                        }
                    }
                }
            }*/


On 9/16/08, Balakrishna <balakrishna.mca@xxxxxxxxx> wrote:

  I am trying to migrate sample application from toplink to eclipselink..   I
am able to migration most of them successfully.. But When view having
references to multiple tables, iam facing problem with invalid identifier
problem.. I am attaching the runtime xml and table creation scripts which
will help to understand and recreate the problem..

Please help me to resolve this problem.

Error in findTroubleTicket ...Order.TroubleTicketSearchResult failed with
exception: Error invoking DAS.count() in das for class:
abc.display.search.TroubleTicketSearchResultLocal Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build 1.0
- 20080707)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00904: "T1"."TRBL_TKT_OID":
invalid identifier

Error Code: 904
Call: SELECT COUNT(*) FROM TRBL_TKT_PRIORITY_LEVEL_CD t3, TRBL_TKT_CATGRY_CD
t2, ROOT t1, TRBL_TKT_VIEW t0 WHERE (((((((t0.TRBL_TKT_TRBL_TKT_ID LIKE ?)
AND (t0.TRBL_TKT_STATUS_CD = ?)) AND (t0.TRBL_TKT_ROOT_OID = ?)) AND
(t0.TRBL_TKT_CATGRY_CD = ?)) AND (t0.TRBL_TKT_PRIORITY_LEVEL_CD = ?)) AND
(t0.ROOT_OWNING_ENTITY_ID IN (?, ?))) AND ((t3.TRBL_TKT_OID =
t0.TRBL_TKT_OID) AND ((t2.TRBL_TKT_OID = t0.TRBL_TKT_OID) AND
(t1.TRBL_TKT_OID = t0.TRBL_TKT_OID))))
    bind => [1000172%, 1, 1000644, 1000080, 1000020, OwningEntity1,
InfinysEnterpriseOwningEntity]
Query: ReportQuery(abc.display.search.TroubleTicketSearchResult)
    at
org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:322)
    at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:646)
    at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:500)
    at
org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:522)
    at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:204)
    at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:190)
    at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:261)
    at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:594)
    at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2505)
    at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:2450)
    at
org.eclipse.persistence.queries.ReportQuery.executeDatabaseQuery(ReportQuery.java:821)
    at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:666)
    at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:844)
    at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:456)
    at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:906)
    at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2588)
    at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1178)
    at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1162)
    at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1108)
  **********************************************************
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    at
weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
    at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
    at
weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
    at
weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Caused by: java.sql.SQLException: ORA-00904: "T1"."TRBL_TKT_OID": invalid
identifier

    http://www.nabble.com/file/p19514631/search.xml search.xml
http://www.nabble.com/file/p19514631/TableCreation.txt TableCreation.txt
http://www.nabble.com/file/p19514631/Doc3.doc Doc3.doc

--
View this message in context: http://www.nabble.com/Problem-with-Multipletables-in-eclispelink.-tp19514631p19514631.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top