The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Primary Key not seen

Last post 05-26-2008, 2:26 PM by David.Parsons. 5 replies.
Sort Posts: Previous Next
  •  05-24-2008, 6:40 PM 9450

    Primary Key not seen

    I am trying to generate the Generated classes for my database with 8 tables.  All 8 tables have primary keys. 

    The LoadByPrimaryKey function for 2 of my tables does not have the 2nd parameter, and thus is getting a compile error.

    The primary key for the 2 tables that this is happening to have integer datatypes, with Identity set to yes.  There are 2 other tables with integer primary keys, defined exactly the same way, and they are working correctly.  The other 4 tables have varchar primary keys, and they are working correctly.

    I scripted the 2 tables as create, and ran the script in another database.  I then generated the Generated classes for these 2 tables from the other database and it created code with the missing parameters, that compiled correctly.

    So, I have a workaround, but why in my real database are the primary keys not being seen in the generation.  I assume if I want to regenerate these classes sometime in the future, I will have to go through this process again.

    Thanks,
    Steve

  •  05-24-2008, 8:56 PM 9454 in reply to 9450

    Re: Primary Key not seen

    We'll need to know what database and version, which code generator and version, and which version of ES.

    In the meantime, you can try this with MyGeneration 1.2.0.7.

    • Set default settings to connect to the db with problems.
    • Open the MyMeta Browser panel.
    • Open the MyMeta Properties panel.
    • In the MyMeta Browser, navigate to the identity key column for one that is not generating.
    • In the MyMeta Properties panel, is "IsInPrimaryKey" true or false?

    David Neal Parsons
    www.entityspaces.net
  •  05-24-2008, 9:12 PM 9455 in reply to 9454

    Re: Primary Key not seen

    Steve, I have seen this rarely on the MyGeneration forums but it does happen. The fact that you scripted it to another database and it works leads me to believe this is the problem. Sometimes database systems (I have seen this with Oracle and SQL Server) get their internal meta data screwed up. If there is anyway for you to drop and recreate those two tables (exporting and saving the data of course) my guess is it will work. I do believe this is the case, however, please be careful if you decide to try this, we do not want you to lose any data. The problem is that this is most likely (I'm pretty sure of it) not a MyGeneration or EntitySpaces issue.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-26-2008, 11:46 AM 9471 in reply to 9455

    Re: Primary Key not seen

    Thanks for the replies.  I did a rename and recreated the tables, and imported the data.  Generating the Generated classes with the new tables worked correctly as you suspected they would.

    Thanks for the help.

    Steve

  •  05-26-2008, 11:56 AM 9472 in reply to 9454

    Re: Primary Key not seen

    David,

    IsInPrimaryKey was False for the 2 tables.  I did what Mike suggested in the message below, and it fixed the problem. 

    I have EntitySpaces Version # 2007.1.1210.0, MyGeneration Version # 1.3.0.3.

    Thanks for replying.
    Steve

  •  05-26-2008, 2:26 PM 9474 in reply to 9472

    Re: Primary Key not seen

    Steve,

    I'm glad Mike's recommendation got it fixed for you. Not having had that problem myself (knock on wood), that probably would have been pretty far down on my list of things to try. So, I learned something myself. Idea


    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML