#1 Re: mORMot 2 » mORMot: CreateMissingTables adds default ID despite existing varchar » 2025-10-07 14:02:17

Thank you for the explanation.
I understand that the ORM requires an integer RowID primary key even for external tables.
However, could you please provide a small example showing how to define a class that uses a varchar ID field together with this RowID integer key?

For example:

How should I declare the class in Delphi?

How to map the RowID to an existing integer field in my external MySQL table?

A short code snippet or schema example would help me understand it better.

#2 mORMot 2 » mORMot: CreateMissingTables adds default ID despite existing varchar » 2025-10-06 17:13:19

FatimaEzzahraa14
Replies: 3

I have a module that contains several classes mapped to database tables. When I use CreateMissingTables in mORMot, it creates the missing tables for the classes. However, there is an issue:

CreateMissingTables automatically adds an ID field to the tables it creates.

In my case, some classes already have an ID field defined as varchar, but CreateMissingTables still tries to add its default ID field as integer.

This causes a conflict because the table ends up with the wrong type for the ID field, or sometimes it fails to create the table correctly.

Goal:

I want CreateMissingTables to respect the existing ID fields in my classes and not automatically add an integer ID field, especially when my class already defines a varchar ID.

#3 mORMot 2 » Atomic Transaction Handling for Multiple Related Entities in SOA » 2025-06-20 14:05:22

FatimaEzzahraa14
Replies: 1

I have a function in SOA that contains 3 parts, each part performs an Add/Update on an entity (we have 3 entities).
          In part 2, there is an entity that has a foreign key to entity 1.
          In this function, we need to perform Add/Update on all 3 entities, but if a problem occurs with any of these entities, all the modifications made in this function must be rolled back.


What is the appropriate solution for this problem?

#4 Re: mORMot 2 » Transaction with Multi-Table » 2025-06-20 09:14:07

TSynUniqueIdentifierGenerator — in which unit is it located?

#5 Re: mORMot 2 » Transaction with Multi-Table » 2025-06-19 16:23:47

Is it possible to give me an example that explains how to use TRestBatch to insert 3 objects, where I need to get the ID of the first object and use it in the second object?

#6 mORMot 2 » Transaction with Multi-Table » 2025-06-19 16:02:10

FatimaEzzahraa14
Replies: 7

As part of a 3-tier architecture (SOA), I need to implement a business function that operates on three different ORM classes, each corresponding to a different table in the database.

My goal is to ensure data consistency by using a transaction: if an error occurs while saving any of the entities, I want all changes to be rolled back.

However, in mORMot 2, the TransactionBegin(Table, SessionID) method appears to support only one class at a time.

Therefore, I am wondering:

         How can I manage a transaction that spans multiple ORM classes (tables) in mORMot?

         Does using transactions in mORMot block other users from accessing or modifying the database during the transaction?

#7 Re: mORMot 2 » Connection To PostGress » 2025-04-14 09:41:12

yes , i use it , how to fix ID instead of RowID

#8 mORMot 2 » Connection To PostGress » 2025-04-12 14:23:18

FatimaEzzahraa14
Replies: 2

When I connect to an external database like PostgreSQL, when using the MultiFieldsValues function, it returns RowId instead of ID.
why

#9 Re: mORMot 2 » IDocList/IdocDict » 2025-03-08 09:53:13

want to extract the elements that do not have a key.
is that possible?

#10 mORMot 2 » IDocList/IdocDict » 2025-03-07 15:46:06

FatimaEzzahraa14
Replies: 2

I am using the Objects property of IdocList.

For example:
var dL: IdocList;
for var d: IdocDicts in dl.Objects('Name=', '')
I found that it skips the d objects that do not have a 'Name'."

It seems like you're trying to iterate through an IdocList and filter or process objects based on their 'Name' property, but the issue is that objects without a 'Name' are being skipped.

#11 mORMot 2 » Search in DocVariantData » 2025-02-27 16:23:48

FatimaEzzahraa14
Replies: 1

exampel :

var dcTest : TDcoVariantData

dcTest := Doc.InitArray([
                  Doc.InitObject(['test', 14]),
                 Doc.InitObject(['test', 41])
             ]);

who to check if the value of 'test' equals 41 in DocVariantData.

Board footer

Powered by FluxBB