#1 2017-09-08 06:42:07

zuoluoq
Member
Registered: 2017-08-15
Posts: 9

How to use direct database connection without any ORM functions

Hi dear author of mORMot,I'd like to get your sincere reply.
I have a question for your framework.
you know,your framework is designed full of ORM,some bit like the Hibernate in java,all OOP designed.
but sometimes we only need the db connection pool and transaction manager ,with writing the dynamic SQL by our-self,
especially for some complex query requirements.We think ORM without any SQL written or all SQL generated by framework is
not convenient sometimes and we need more time to learn it.
Maybe you can add the functions like Mybatis in Java,only for sql-mapping by all SQL  written by our-self.
actually,we don't need to change the Database frequently on production environment.SQL dialect - Database combination is normal.
An other question is ,in SQLRecord class ,the property ID,is designed for TID,which is int64 with high primary index performance,
but it is generated with auto-increment.Can we use our ID generator written by our-self or provided by your framework?
even if it can support the string type like UUID, I think it should not be constrained by any framework,actually it will be high performance if it is designed with int64.
if the ID is filled with generated content ,it will be convenient for us to merge database content without any primary or foreign key conflict.
Thank you.

Offline

#2 2017-09-08 06:43:22

zuoluoq
Member
Registered: 2017-08-15
Posts: 9

Re: How to use direct database connection without any ORM functions

Hi,this is the reply from our author with e-mail.and I paste it here as ab wanna.

Please us the forum for such discussion.
It may help others.

1. For direct SQL statements, idea with mORMot is to always define a "persistence" service as an interface.
Then you may run the queries either via the ORM, or direclty using the SQLite3 engine, or the SynDB instance.
In SynDB, you have direct JSON output, and/or access via variant late binding, which is close to what you expect.

2. If you set "ForceID=true" for TSQLRest.Add, you can specify your own ID value.
See TSynUniqueIdentifierGenerator for a 64-bit integer ID generator.

Offline

#3 2017-09-08 18:17:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: How to use direct database connection without any ORM functions

Thanks for sharing here!
smile

Offline

Board footer

Powered by FluxBB