Notifications
Clear all

[Solved] Duplicate fields in generated DAOs

2 Posts
2 Users
0 Reactions
1,334 Views
0
Topic starter

A build process returned a series of DAO error messages. They state that variables are already defined.

[javac] Compiling 54 source files to C:\ib\NCMS_3.1\apps\NCMS\build\regen-dao
[javac] C:\ib\NCMS_3.1\apps\NCMS\build\regen-dao\com\transcendsys\platform\base\dao\AttachmentAdtRow.java:125: error: variable sysAttachmentId is already defined in class AttachmentAdtRow
[javac]   private Long sysAttachmentId;
[javac]                ^
[javac] C:\ib\NCMS_3.1\apps\NCMS\build\regen-dao\com\transcendsys\platform\base\dao\AttachmentAdtRow.java:126: error: variable modelName is already defined in class AttachmentAdtRow
[javac]   private String modelName;
[javac]                  ^
[javac] C:\ib\NCMS_3.1\apps\NCMS\build\regen-dao\com\transcendsys\platform\base\dao\AttachmentAdtRow.java:127: error: variable creationUser is already defined in class AttachmentAdtRow
[javac]   private String creationUser;
[javac]                  ^
[javac] C:\ib\NCMS_3.1\apps\NCMS\build\regen-dao\com\transcendsys\platform\base\dao\AttachmentAdtRow.java:128: error: variable creationDate is already defined in class AttachmentAdtRow
[javac]   private java.sql.Timestamp creationDate;

What can cause this? And what is the solution?

2 Answers
0

Additional details:

Looking at the DAO generation logic, it gets database metadata from the jdbc connection. My suspicion is that oracle is using a LIKE query to get the metadata. You may recall, the underscore _ is treated as a single-char wildcard in oracle like statements. https://www.techonthenet.com/oracle/like.php

Thus if you have these users in the DB:

NCMS_3_1
NCMS_311

If Oracle internally says “select from all_columns where owner like ‘NCMS_311’” it will get only the NCMS_311 objects.

But if Oracle says “select from all_columns where owner like ‘NCMS_3_1’” I think it will match both the NCMS_311 and NCMS_3_1 objects.

This seems to add up to what you are observing, it would cause this kind of duplication of fields. Ideally Oracle should only return exact matches to the schema name, I don’t know why it’s doing a LIKE.

Your most pragmatic solution is likely to reboootstrap NCMS_3_1 with a username of NCMS_3x1 or something similar that won’t match.

0
Topic starter

In this case the problem turned out to be that the developer's computer had 2 similarly named database schemas:

"NCMS_3_1" and "NCMS_3_11"

Dropping the "NCMS_3_11" schema allowed the "NCMS_3_1" build to succeed.