EMissingSequence

Hi.


Using a TAureliusConnection component, Generate entities from database...
If I use Firebird, with a table whose primary index is not compound, and of type Integer or SmallInt, I get this exception.

Using Data modeler export, I can bypass this, under mappings, using the advanced tab, and indicating the sequence/generator to use.

How can I do this from the TAurelius component, so as not to have to depend on the Data Modeler?

Thank you. 

I am aware that I could disable check for missing sequences, and add the sequence attribute, but this is not elegant.

Why you don't want to use TMS Data Modeler. That's why it's there - it's a much more advanced tool for generating entities. It also has customization scripts. It's a full project you can save. TMS Aurelius generate entities is just a "quick" IDE tool to help with quick starting. I don't think it makes much sense to add the whole Data Modeler user interface and tool mechanism inside Delphi IDE?

I agree. But as far as I can see, there is very little missing to complete the mapping tab, of the Data Modeler export option, in the TAureliusConnection component, and that is all it would require.


Thank you anyway.

That would require the user to manually set the sequences for all tables, only to repeat the operation again if needed. I think it's just easier to manually modify the generated source code. Or use Data Modeler. We can consider it, but as I said, it's already implemented in Data Modeler. For a one time operation, I don't see a reason for not using Data Modeler.

Specifically for Firebird.

Yeah I don't think it is that big a problem for Firebird sequences/ generators

select rdb$generator_name from rdb$generators where rdb$system_flag = 0;
in a drop down list as per the data modeler.

When it comes down to the Data Modeler and Firebir, it is a manual process, each table needs to be done individually. Maybe once only as indicated.

Due to work pressure/ time constraints when trying to follow along with the on line videos. I always came to a dead end with Aurelius and Generate entities from database when it comes to a Firebird database. So I was thinking in the beginning that my database structure was at fault and would require a big change to use Aurelius, so it went on the back burner.

Recently did an audit of our database structure. Every table has an anonymous primary key, not related to data.

Seems to be a firebird meta data / Aurelius problem? not sure, no expert on these things.

However if I had a drop down list of sequences when using Aurelius and Generate entities I would have appreciated it a lot more.

Seems a simple solution to me, not requiring or requested that the whole Data Modeler functionality be migrated, again, no expert on these things.

Simon

I'm not aware of such anonymous PK issue. If possible, can you please elaborate? About sequences, usually the user has a naming scheme where the name of sequence can be inferred from the name of the table. That's why scripts are usually the best approach for it.

Hi Wagner.
Probably my terminology,
By anonymous I mean a PK that is independent of the data fields in the table.

Paragraph on Surrogate keys.
No issue , just by way of explanation that all tables have a primary key

The issue is that there is no way using AureliusConnection to Generate entities from a Firebird database without setting the Check for missing sequences to Never.

What are the implications of using Aurelius with this setting if all tables have an on insert trigger
if ( PK is null) then begin
use a Sequence for the PK
end

Looked through the Aurelius Docs (pdf) . Could not find anything on using scripts.
Can you point me to any docs to fill in the missing sequences?

Thanks, Simon

What you can do is set the dialect to Firebird 3, and the id generators to be IdentityOrSequence. This way, Aurelius will do an INSERT without sending any id, and will retrieve the id generated at the server-side by your trigger.

It's here: