7 Replies Latest reply: Jul 18, 2013 10:02 PM by Kent Graziano RSS

    duplicate fields generated in forward engineering

    user5524045

      I just started using version 3.3, and I've encountered the following strange error. I can add the relationship in the logical model no problem but when I forward engineer the relationship I get two fields created in the relational model. One field has the proper name but is just a name field without a connection to the foreign key. The second field is suffixed with a '1' and is connected to the foreign key.

       

      Has anyone seen this before? Is there a setting I need to modify?

       

      Thanks

       

      Terry

        • 1. Re: duplicate fields generated in forward engineering
          Kent Graziano

          Usually when I have seen this it is because you put an attribute in the child entity (in the logical model) to represent the future FK column that is inferred by the relationship. In Data Modeler, the forward engineering will automatically take the PK column(s) from the parent entity and cascade it forward into the child. Hence you get attribute_1 in the engineered table as it appears to be a duplicate column name.

           

          If you switch the diagramming style in the logical model from Barker notation to either IE or IDEF, you will see the issue. Barker notation, as a standard, does not show the inherited attributes in the logical model, but they are there behind the scenes. The other two styles show then so the logical model looks more like the relational tables that will result after the forward engineering occurs.

           

          So the solution is to go back to your logical model and delete the attribute in the child entity then run your forward engineer.

          • 2. Re: duplicate fields generated in forward engineering
            user5524045

            Thanks Kent. I changed the notation and I can indeed see the child field in the logical model now. The problem is that there doesn't appear to be a duplicate field in the logical. The logical looks fine with only the one child field that is associated to the relationship. (I can't delete it unless I remove the relationship)

             

            But then when I engineer to the relational model I still get the duplicate fields...

             

            thoughts?

            • 3. Re: duplicate fields generated in forward engineering
              Kent Graziano

              Odd. So back in Barker notation - do you see the field there? (If so delete that one).

               

              Did you delete the relational table and try a fresh forward engineer? Forward engineering does not usually delete objects that are already there but will update the relational structure instead (so maybe the duplicate is an artifact of an earlier effort?)

               

              My only other thought would be to look carefully at all the various tabs in the forward engineer dialog to see if there is another clue - like an extra relationship or something?

              • 4. Re: duplicate fields generated in forward engineering
                user5524045

                Thanks Kent. In Barker notation the field isn't there. So everything is good in the Logical.

                 

                Your thought about deleted the relational table worked. I took it a step farther and regenerated the entire relational model. That works great! I am able to engineer relationships now...maybe something got messed up in the relational model...

                 

                But, I then lose the db scripts I have added per table in the relational model. Do you know of anyway to transfer scripts between relational models?

                 

                getting there...

                 

                Thanks

                 

                Terry

                • 5. Re: duplicate fields generated in forward engineering
                  Kent Graziano

                  Great news.

                   

                  What do you mean by db scripts? Had you attached something to the before or after create tabs?

                   

                  Are they standardized or custom per table? If they are per table you *might* be able to write a custom transformation script (under Tools--> Design Rules) to copy them between the models (like the Copy Comments to Comments in RDBMS script, but with different object calls etc). Not an expert in this area. Either Philip or David are better to answer that one.

                   

                  (BTW - being able to have multiple relational models in on design is a nice feature)

                  • 6. Re: duplicate fields generated in forward engineering
                    user5524045

                    Yea, different DB scripts that populate the tables with reference data. Seemed like a good idea at the time...

                     

                    I looked at the copy comments scripts but I'm afraid I don't know enough to code them. Is there a document available that lists the available methods and attributes?

                     

                    Thanks Kent

                     

                    Terry

                    • 7. Re: duplicate fields generated in forward engineering
                      Kent Graziano

                      Documentation is here: \datamodeler\xmlmetadata\doc