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

Your descriptor xml seems correct, it seems this is a bug in our multiple
tables.  Please log the bug.

As a workaround you can use an amendment method to fix up the descriptor's
multiple table foreign keys.



Balakrishna 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
> 
> When i attached the eclipselink source to debug the problem, I did find
> that the following method is giving problem,  It is storing wrong
> references as join conditions which is givng problem at run time
> 
>   initializeMultipleTablePrimaryKeyFields(){	 
> 	 // 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);
>                         }
>                     }
>                 }
> 
>  You can refer the attached files to recreate the problem... 
> 
> 
>     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 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Problem-with-Multipletables-in-eclispelink.-tp19514631p19534265.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.