telosystools

Open full view…

Converter error : Entity TestEntity: TestEntityID: FK error : 'TestEntityID' is

morula
Fri, 02 Jun 2023 20:41:12 GMT

not an ID/PKWhen I generate a model from a database (via cli > nm xmodel xdatabases) foreign keys are created. However, the entities do not have defined primary keys. So the following error occurs during the generation: [ERROR] : Invalid model ! Converter error : Entity TestEntity: TestEntityID: FK error : 'TestEntityID' is not an ID/PK attribute in entity 'PrimaryEntity'. Cannot load model => stopping code generation. Can't the generation of the links and FK attributes be dispensed with when generating using the "nm" command? Would there be a parameter that ignores the condition of the @ID annotation? Many greetings Daniel

Telosys Team
Wed, 14 Jun 2023 13:22:32 GMT

What database are you using? (normally it's not possible to have a FK which does not reference a PK) For information, link generation will be configurable in the upcoming version (2 parameters in databases.yml : linksManyToOne and linksOneToMany = true/false)

morula
Sun, 18 Jun 2023 07:56:59 GMT

Thank you for the answer. It is a MS SQL database. The tables are also defined somewhat untypically. Instead of referencing the actual PrimaryKey, each one references a different unique key: CREATE TABLE Account ( AccountCategoryCode int NULL, AccountId uniqueidentifier NOT NULL, ItemID int IDENTITY(1,1) NOT NULL, CONSTRAINT Account_PK PRIMARY KEY (ItemID) ); CREATE UNIQUE NONCLUSTERED INDEX IX_Account_AccountId ON Account ( AccountId ASC ) ON [PRIMARY ] ; CREATE TABLE Contact ( ItemID int IDENTITY(1,1) NOT NULL, AccountId uniqueidentifier NULL, ContactId uniqueidentifier NULL, CONSTRAINT Contact_PK PRIMARY KEY (ItemID), CONSTRAINT Contact_Account_FK FOREIGN KEY (AccountId) REFERENCES Account(AccountId), ); CREATE NONCLUSTERED INDEX IX_Contact_AccountId ON Contact ( AccountId ASC ) Unfortunately I am not the database owner. Therefore I have only limited possibilities. When will the next version of Telosys CLI be released?

Telosys Team
Wed, 28 Jun 2023 10:45:36 GMT

Telosys-CLI ver 4.1 will be released in July

morula
Thu, 07 Sep 2023 09:25:55 GMT

I have now tested it with version 4.1 and the settings in databases.yml (linksManyToOne and linksOneToMany = true/false). Unfortunately I still get the message ".... FK error : 'xxx' is not an ID/PK attribute in entity 'yyyy'". Is there any way to not generate the @FK attributes when exporting from the database model? Without it would work.