Reverse Engineering MaxDB / SapDB does not produce foreign keys

Description

Foreign keys not produced when reverse engineering from MaxDB / SapDB

Environment

Hibernate 3, MaxDB 7.6

Activity

Show:
Laurence Sargent
November 21, 2008, 8:04 PM

Suggested fix forces null rather than zero length string into the catalog

Max Rydahl Andersen
November 24, 2008, 2:07 PM

So "" is returned from the query resul tbut when we use that for input to a new query it breaks or is it some logic inside hibernate tools that breaks ?

I don't have a MaxDB install so haven't been able to test but would like to know if it is a unique quirk with MaxDB or something we should fix for all dialects instead of having a specific db ?

Laurence Sargent
November 25, 2008, 6:54 PM

I think the problem arises because in the JDBCReader tables are added to the DatabaseCollector with the catalogName forced to null when a zero length string is found.

i.e.
if (catalogName!=null && catalogName.trim().length()==0) {
catalogName=null;
}

However when processForeignKeys looks up the foreign key tables it uses the getCatalogForModel() method which leaves a "" zero length string unchanged
i.e. fkCatalog = getCatalogForModel((String) exportedKeyRs.get("FKTABLE_CAT"))

As a result, all foreign key tables are filtered out because the reference is unknown. I think the same problem would apply if the schema were null.

Max Rydahl Andersen
November 26, 2008, 6:53 PM

Good catch - I need to look into why that nulling was done (most likely because of oracle's broken assumption that "" == null)

Assignee

Koen Aers

Reporter

Laurence Sargent

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Priority

Blocker
Configure