Anand Kumar created OPENJPA-2434:
------------------------------------

             Summary: Open JPA not resolving foreign keys when generating beans 
by connecting to Oacle DB
                 Key: OPENJPA-2434
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2434
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.2.0
            Reporter: Anand Kumar


I am trying to generate beans by connecting to Oracle DB. In the logs i see 
that its trying to resolve Primary keys, Indexes and foreign keys. However, 
does not find any foreign keys for the tables having FKs.

I checked the code and found below:
File: org.apache.openjpa.jdbc.sql.OracleDictionary.java
Method:  public ForeignKey[] getImportedKeys(DatabaseMetaData meta, 
DBIdentifier catalog,
        DBIdentifier schemaName, DBIdentifier tableName, Connection conn, 
boolean partialKeys)

Line#951
setString(stmnt, idx++, convertSchemaCase(tableName), null);

I think we should use unqualified tableName, since the query to fetch the FKs 
returns no result for qualified table names.

setString(stmnt, idx++, convertSchemaCase(tableName.getUnqualifiedName()), 
null);




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to