danieleteti / delphi-orm Goto Github PK
View Code? Open in Web Editor NEWDORM, the "Delphi ORM"
DORM, the "Delphi ORM"
Any chance you have had a chance to look at the demos? They compile but none of
them run "out of the box". They all have some problem that prevents them from
running correctly.
Also is it not possible to have a really basic demo? Just inserts, deletes and
selects?
Thanks
Original issue reported on code.google.com by [email protected]
on 24 Sep 2012 at 4:52
There isn't a MappingCreator for SQLServer (EMBT dbxExpress driver)
Original issue reported on code.google.com by [email protected]
on 5 Jan 2012 at 8:52
Support for mapping classes using attributes instead of an external json
mapping.
Maybe there will be situations where a mapping is dificult/impossible to
express via attributes, but for these cases the programmer can always use the
standard json mapping. As for the most cases, I think a good set of attributes
will do the job much better than the json mapping.
For exemple, this class:
type
TCustomer = class
private
FId: Integer;
FName: String;
FAge: Integer;
public
property Id: Integer read FId write FId;
property Name: String read FName write FName;
property Age: Integer read FAge write FAge;
end;
Could be mapped this way:
type
[Table('CUSTOMER')]
TCustomer = class
private
[PrimaryKey]
[Column('ID')]
FId: Integer;
[Column('NAME')]
FName: String;
[Column('AGE')]
FAge: Integer;
public
property Id: Integer read FId write FId;
property Name: String read FName write FName;
property Age: Integer read FAge write FAge;
end;
And if http://code.google.com/p/delphi-orm/issues/detail?id=5 got implemented,
the class with it's complete mapping would be reduced to:
type
TCustomer = class
private
[PrimaryKey]
FId: Integer;
FName: String;
FAge: Integer;
public
property Id: Integer read FId write FId;
property Name: String read FName write FName;
property Age: Integer read FAge write FAge;
end;
Original issue reported on code.google.com by [email protected]
on 17 Nov 2011 at 6:58
delphi-orm will access mongoDB?
I think delphi-orm access mongoDB, a NoSQL DB
Original issue reported on code.google.com by [email protected]
on 16 Aug 2012 at 2:11
Using the GetEnumerator method instead of looking for property Items (only
available in XE2) or GetItem/GetElement (only possible if these methods are
public or published) would make this more flexible and compatible with older
Delphi versions (actually I think DORM should have full XE support).
I was looking if there is some special place where specific items are accessed
but it is always like for i := 0 to list.count -1 do list.GetItem(i)
This could be done with for item in list do if you implement the GetEnumerator
in TDuckTypedList. Then also at least persisting data from a list could done
with TEnumerable instead of having all the extra TList methods.
Original issue reported on code.google.com by [email protected]
on 2 Dec 2011 at 7:45
Include Connection to Oracle
Original issue reported on code.google.com by [email protected]
on 31 Jan 2014 at 1:46
Delphi XE Compiling DORM_UnitTests_XE.dproj
When I try to compiling this project I get this error in follow unit
File not Found
System.Generics.Collections.dcu
Unit
dorm.Filters
dorm.Utils
dorm.UOW
dorm.Metadata
TestDORMSearchCriteria
TestDORMSpeed
dorm.adapter.Firebird
I have replace System.Generics.Collections with Generics.Collections and now
the code compiling.
Original issue reported on code.google.com by [email protected]
on 21 Dec 2011 at 10:13
The username ans password are now stored in plain text in the conf file. This
is not always wanted.
Some sort of encryption should be provided with either a 2-way encoding (less
secure) or work with private and public keys (more secure).
Original issue reported on code.google.com by [email protected]
on 2 Jan 2012 at 4:13
I found an error in the compilation of the project DORM_UnitTest.dpr for XE2
When I try to compile I get an error Incompatible type TPerson and TObject
I checked and found that the procedure that creates problems is the following.
Commenting on the highlighted line with>>> the project is compiled.
procedure TTestDORM.TestFindOne;
var
p: TPerson;
p1: TPerson;
begin
p := TPerson.NewPerson;
try
Session.Persist(p);
>>> p1 := Session.FindOne<TPerson>(TdormCriteria.NewCriteria('ID',
>>> TdormCompareOperator.coEqual, p.id));
try
CheckEquals(p.id, p1.id); // same data
CheckFalse(p = p1); // different objects
finally
p1.Free;
end;
finally
p.Free;
end;
end;
Original issue reported on code.google.com by [email protected]
on 3 Jan 2012 at 11:39
What steps will reproduce the problem?
1.Compile the source code
What is the expected output? What do you see instead?
You'll get hints and warnings, which shouldn't be there.
What version of the product are you using? On what operating system?
XE2
Please provide any additional information below.
Patch file added
Original issue reported on code.google.com by [email protected]
on 27 Nov 2011 at 5:30
Attachments:
Daniele,
Are you sure that you don't miss the VER240 line 89 ?
{$if defined(FPC) or defined(VER170) or defined(VER180) or defined(VER190) or
defined(VER200) or defined(VER210) or defined(VER220) or defined(VER230)}
{$DEFINE HAVE_INLINE}
{$ifend}
When you confirm that, I will port your changes to SO upstream repo. (I don't
have XE3 for now)
Thank you very much,
-- Pierre Yager
Original issue reported on code.google.com by [email protected]
on 2 Jan 2013 at 9:36
What steps will reproduce the problem?
1. Just build any of the 4 examples and run it
2. AV in TSession.CreateLogger
What version of the product are you using? On what operating system?
Delhpi XE2 sp2 32-bits on win7 64-bits
Adding dorm.loggers.CodeSite.pas to the project resolves the issues as at that
point the class gets registered.
Original issue reported on code.google.com by [email protected]
on 9 Dec 2011 at 3:11
The MappingCreator doesnt work, when clicking on the Generate Mapping button i
get a message saying "Still not implemented", this app seems to want to
generate the database connection settings files which is greate but the
important one however is a project to generate the ".mapping" files (the files
with the definitions to save the classes to the database).
There seems to be a project that is designed to do that
(persistancecreator.dproj). this compiles fine but as soon as it starts the app
just shuts down :-? not sure where the problem is.
The important thing for me is to be able to have an app that can generate the
".mapping" files, the connection settings i can handle doing by hand but the
mapping is just too much of a mammoth task.
Any ideas for a work around for the mean time would be great!
By the way this is an awesome framework :-)
Regards
Donovan
Original issue reported on code.google.com by [email protected]
on 17 Apr 2013 at 9:32
What steps will reproduce the problem?
1.can not find the source dorm.metadata.pas.
where is it?
Original issue reported on code.google.com by [email protected]
on 9 May 2012 at 8:14
In TSession object there are members
FUOWInsert, FUOWUpdate, FUOWDelete: TObjectList<TObject>;
which are never used.
Seems this functionality is replaced (?) by TdormUOW in dorm.UOW.pas
Original issue reported on code.google.com by [email protected]
on 5 Jan 2012 at 7:24
1. Delphi XE (PersistenceIgnorance)
2. When I try to run I see this error message
Adapter [dorm.adapter.Firebird.TFirebirdPersistStrategy] not found
How I can solve this problem.
Original issue reported on code.google.com by [email protected]
on 7 Dec 2011 at 9:38
1.I think the Entity class must support attribute with delphi xe/xe2.
such as attribute of Entity class can known field property:field size/required/displaylabel.....
2.Entity class is record type or interface type.record type or interface type
dont need free it.
Original issue reported on code.google.com by [email protected]
on 24 Jun 2012 at 4:52
What steps will reproduce the problem?
1. Compile 'PersistenceIgnorance.dproj' (XE3)
What is the expected output? What do you see instead?
A running application.
What version of the product are you using? On what operating system?
Delphi XE3, Interbase XE64, Windows 7, 64-bit
Please provide any additional information below.
The charset parameter is missing. Putting '' as the 5th parameter works. But
putting 'UNICODE_FSS' gives 'Invalid charset' error. We use UNICODE_FSS.
Message:
[dcc32 Error] dorm.adapter.UIB.Interbase.pas(39): E2035 Not enough actual
parameters.
Line:
Result := TUIBFacade.Create('gds32.dll', Conf.S['username'], Conf.S['password'], Conf.S['database_connection_string']);
Original issue reported on code.google.com by [email protected]
on 15 May 2014 at 2:07
It would be nice if DORM supported CoC.
For exemple: Consider this class:
type
TCustomer = class
public
property Id: Integer read FId write FId;
property Name: String read FName write FName;
property Age: Integer read FAge write FAge;
end;
The framework could assume that this class is mapped to a table called
CUSTOMER, and the properties are mapped to fields called ID, NAME and AGE. The
only mapping would be to inform the primary key field.
For cases where the programmer doesn't want to follow this convention (maybe on
legacy databases), he can simply do the manual mapping as we already do today
Original issue reported on code.google.com by [email protected]
on 17 Nov 2011 at 6:48
Delphi XE
I compiling MappingCreator and I have same error Unit not found
I have removed same prefix System. in the code and Vcl.
I see that this issue is removed from Daniele with compiling directive.
Can you add this directive in the code ?
{$IF CompilerVersion > 22}
System.Generics.Collections
{$ELSE}
Generics.Collections
{$IFEND}
Removed this prefix the program run fine!
Original issue reported on code.google.com by [email protected]
on 21 Dec 2011 at 11:11
how do I map a property of an entity to accept null value?
Original issue reported on code.google.com by [email protected]
on 27 Mar 2014 at 5:26
The nullable attribute is ignored on columns when performing an update or insert.
I believe the simplest path to get this working is to modify SetSqlite3ParameterValue to also pass the current field mapping and a similar substitution made for null as what is done for an empty blob.
In the test case that I came up with, I have an optional column which is a string and indexed unique. Not allowing empty string to be nulls would mean that the field is no longer optional and would generate a key violation.
Currently, to use the automatic validation, a BO must descend from TdormObject.
Should be better if, to use validation, I have to implement an interface only.
Original issue reported on code.google.com by [email protected]
on 27 Nov 2011 at 4:51
[DCC Warning] superobject.pas(963): W1000 Symbol 'DecimalSeparator' is
deprecated: 'Use FormatSettings.DecimalSeparator'
[DCC Warning] superobject.pas(967): W1000 Symbol 'DecimalSeparator' is
deprecated: 'Use FormatSettings.DecimalSeparator'
[DCC Warning] superobject.pas(981): W1000 Symbol 'DecimalSeparator' is
deprecated: 'Use FormatSettings.DecimalSeparator'
[DCC Warning] superobject.pas(985): W1000 Symbol 'DecimalSeparator' is
deprecated: 'Use FormatSettings.DecimalSeparator'
[DCC Warning] dorm.Utils.pas(318): W1036 Variable 'Method' might not have been
initialized
>>>[DCC Fatal Error] dorm.loggers.CodeSite.pas(43): F1026 File not found:
'CodeSiteLogging.dcu'
Fun fact:
DORM in Portuguese phonetically equals SLEEP = Hibernate
Marcio Martins
[email protected]
Original issue reported on code.google.com by [email protected]
on 3 Jan 2012 at 11:50
TSession.FindOne raises an exception whenever the query return zero or more
than one object.
I agree that when it returns more than one object, an exception must be raised
because it's realy an exceptional case.
But when no object is found, I think it's better to return nil instead, because
this is a normal case. For exemple, during login I can search for the user on
the database based on the user login:
User := FSession.FindOne<TUser>(TdormCriteria.Create.Add('Login', Equal,
TValue.From(EditLogin.Text)));
And it's a pretty normal situation if the object that I'm looking for doesn't
exist.
But when that happens, with the current behaviour, I can't properly handle the
situation because the same exception is raised both when no record is found and
when more than one record is found.
Also, I noticed that the two overloads of FindOne have different behaviours
when the search returns no object.
The overload that takes a Type Info parameter seems to return nil when no
object is found
But the overload that takes a generic argument raises the exception when no
object is found.
Is it the designed behaviour of both methods? I thought that the overload with
the generic argument existed only to free us from doing type casts
Original issue reported on code.google.com by [email protected]
on 17 Nov 2011 at 8:35
The "Commanders" are needed where a single SQL operation is faster than a
classic ORM approach. Let's say we have a table called PRODUCTS and we need to
apply a discount of 20% on all products. Using the current implementation I've
to load all the products, applica the discount and then save them one by one.
This is the corrent way to to things if there are consistency check o validity
check implemented in the object, but is there aren't validity check, I need a
faster way. A commander is for an UPDATE/DELETE/INSERT what a finder id for
SELECT.
Will be used in the same way but do not return any lists.
Session.Execute(TApplyGlobalDiscount.Create(20));
Original issue reported on code.google.com by [email protected]
on 3 Jan 2012 at 1:57
What steps will reproduce the problem?
1. Put classes TPerson and TLaptop (from the example project) to different
units and change mapping file accordingly.
2. Call TSession.LoadRelations with an instance of TPerson object.
What is the expected output? What do you see instead?
I get an exception with message "Unknown type TLaptop" which shouldn't happen.
What version of the product are you using?
Latest as of February 11th, 2012.
Please provide any additional information below.
The problem seems to be in TSession.LoadHasManyRelationByPropertyName method,
where _table is the mapping of parent class, but is used for finding child
class type.
Same problem occurs with belongs to relation as well and by looking at the
code, I would presume that it's the same for has one relation (but I haven't
tested it yet).
Original issue reported on code.google.com by [email protected]
on 11 Feb 2012 at 12:37
Is it supposed to work with D2010??
Original issue reported on code.google.com by [email protected]
on 30 Oct 2011 at 12:44
What steps will reproduce the problem?
1. Cant compile on Delphi XE3
What is the expected output? What do you see instead?
Compiled.
What version of the product are you using? On what operating system?
Delphi XE3, Windows 7, 64-bit
Please provide any additional information below.
Message:
[dcc32 Error] dorm.pas(1302): E2250 There is no overloaded version of
'LoadList' that can be called with these arguments
Line:
LoadList(T, Criteria, AObject);
Fix?:
LoadList<T>(Criteria, AObject);
Original issue reported on code.google.com by [email protected]
on 15 May 2014 at 2:11
TDormUOW class seems quite dangerous to use.
Problem 1. FUOWDelete object ownership is not very good idea:
constructor TdormUOW.Create;
begin
...
FUOWDelete := NewList(true); // this MUST delete also the objects // I think this is right only when Session.Save(MyUOW) is called and when DB-level transactions are not used
end;
destructor TdormUOW.Destroy;
begin
...
FUOWDelete.Free; // This will free all objects, registered for delete, even if there was no call to Session.Save(MyUOW);
...
end;
procedure TdormUOW.Clear;
begin
...
FUOWDelete.Clear; // this MUST delete also the objects. WHY???
end;
Solution 1.
FUOWDelete list should not "explicitly" own objects, registered for delete.
These objects should be extracted from this list and freed inside the call to
Session.Save(MyUOW).
Solution 2.
TDormUOW should call .Cancel before Clear and Destroy
Problem 2. FUOWDelete.Cancel seems incomplete, because it clears only
"Delete-list", but not clears Insert and Update lists.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2012 at 7:45
I believe it is as simple as changing the function to read:
function TSqlite3PersistStrategy.ExecuteCommand(ACommand: IdormCommand): Int64;
begin
Result := ExecuteAndGetFirst(aCommand.GetSQL);
end;
请问什么时候能支援Access 的 mdb 谢谢
Original issue reported on code.google.com by guoqingaa
on 7 Dec 2011 at 12:53
How u dont have a forum yet, i dont know where put this message, then i will
put here ok?
I whould like see a 3tier system sample. Can you show us?
Remove this message and send me a mail if u think better!
Original issue reported on code.google.com by [email protected]
on 7 Nov 2011 at 12:06
If I add next section to sample.mapping file, then nothing happens on
LoadRelation method, cause "Owner" name turn on CoC strategy and turn on
lazyload too
"Has_one": [{
"Name": "Owner",
"Class_name": "TPerson",
"Child_field_name": "ID",
"Lazy_load": false}]
if i add new propery to TLaptop (Person instead Owner) and add next section to
sample.mapping file instead of previous section
"Has_one": [{
"Name": "Person",
"Class_name": "TPerson",
"Child_field_name": "ID",
"Lazy_load": false}]
then i got recursive executions started at
function TSession.Load(ATypeInfo: PTypeInfo; const Value: TValue): TObject;
look at this lines:
if assigned(Result) then
begin
_idValue := GetIdValue(_table.Id, Result);
LoadBelongsToRelation(_table, _idValue, rt, Result);
LoadHasManyRelation(_table, _idValue, rt, Result);
LoadHasOneRelation(_table, _idValue, rt, Result);
end;
so after load belongs_to relation for TLaptop DORM starts load relations for
TPerson result object and then try to load relation for TLaptop again and so on
and so on..
any advice?
Original issue reported on code.google.com by [email protected]
on 16 Jul 2012 at 2:43
Hello again
I am trying to isolate the bare minimum of sources to have a small orm for
Firebird, unfortunately i am IDormSearchCriteria is missing - i am unable to
find it.
Which unit have i missed?
S.
Original issue reported on code.google.com by [email protected]
on 8 Mar 2015 at 11:48
Demos doesn't work, you should use sqlite databases for the demos
And by the dates, I guess delphi-orm is dead
Remove TdormCollection. I want to be free to use TObjectList<T>. No
framework-specific code should affect my BOs.
Original issue reported on code.google.com by [email protected]
on 6 Nov 2011 at 8:09
get error: [dcc32 Error] E1026 File not found: 'dorm_runtime_xe4.res'
requires
rtl,
dorm_runtime_xe4, // --> change into dorm_runtime_xe5
designide,
vclimg,
DbxCommonDriver;
Original issue reported on code.google.com by [email protected]
on 7 Mar 2014 at 7:13
Please use a relative path in the connection string for the database in the
unittests and add the fbclient.dll. That way the unittests should always be
succesful, whcih is not the case if either requirement is not met.
Original issue reported on code.google.com by [email protected]
on 29 Dec 2011 at 2:41
Hello,
For example, If I add a MemoryStream field to TCustomer, data is persisted correctly, however there is a memory leak when closing the program. I am using the sqlite adapter.
[Entity('CUSTOMERS')]
TCustomer = class
private
FName: String;
FEMail: String;
FID: Integer;
FCreatedAt: TDate;
FADDRESS: String;
FImage: TMemoryStream;
procedure SetADDRESS(const Value: String);
procedure SetCreatedAt(const Value: TDate);
procedure SetEMail(const Value: String);
procedure SetID(const Value: Integer);
procedure SetName(const Value: String);
public
constructor Create;
destructor Destroy; override;
property ID: Integer read FID write SetID;
property Name: String read FName write SetName;
property Address: String read FADDRESS write SetADDRESS;
property EMail: String read FEMail write SetEMail;
[Column('CREATED_AT')]
property CreatedAt: TDate read FCreatedAt write SetCreatedAt;
property Image: TMemoryStream read FImage write FImage;
end;
constructor TCustomer.Create;
begin
FImage := TMemoryStream.Create;
end;
destructor TCustomer.Destroy;
begin
FImage.Free;
inherited;
end;
The leak occurs when performing an update or delete operation.
I have adapted the Hello World demo to a VCL GUI, so memory leak reporting occurs.
I added a image field to the db declared as BLOB.
Am I doing something wrong, or is this a bug?
Is the project maintained yet?
There is no releases and the commits are dated from 3 years ago.
DelphiMVCFramework has releases.
Just a simple question
Have you provided an optimistic concurrency control for object persistence.
Hibernate has it through @Optimistic annotation on a field.
It is basically a date/int field for each table/object in database and gets
compared/incremented at the end of each transaction commit.
Original issue reported on code.google.com by [email protected]
on 4 Mar 2015 at 9:11
An integer field on the object which represents it's 'version' and is
automaticaly handled by DORM. This can be used to implement optimistic locking.
Consider this type:
type
TCustomer = class
private
FId: Integer;
FVersion: Integer;
FName: String
end;
When the object is created, the version is initialized to, say, zero.
Whenever the object is updated (TSession.Update), the framework will
automatically increment the FVersion field, and will include the old version
number on the where clause of the update statement, generating something like
this:
update CUSTOMER set NAME=:name, VERSION=:new_version, ... WHERE ID=:id AND
VERSION=:old_version
After running the statement, if the affected record count is zero, that means
that the object has been removed or modified by someone else, and then the
update operation should fail.
The version field should be persistent, but it doesn't need to be exposed as a
public property of the business object. And, to support guys with legacy
databases or that for any reason doesn't want versioning, it should be an
optional feature.
Original issue reported on code.google.com by [email protected]
on 19 Nov 2011 at 2:26
I would implementing mapping by attributes on DORM
and i see that are mixing on dorm.cfg
{
"persistence": {...},
"mapping": {...}
}
I think that this should be splitted in:
dorm.cfg
dorm.map
So i can continue using dorm.cfg to things about connection and strategies, and
dorm.map we can use or no (when using attributes).
Original issue reported on code.google.com by [email protected]
on 10 Nov 2011 at 3:02
Please add packages for Delphi XE and XE2.
This will prevent recompilation of the source code when used in projects.
please make sure then that database support is separated into packages as well.
If needed I'd be happy to provide the dpk's.
Original issue reported on code.google.com by [email protected]
on 25 Dec 2011 at 12:02
I'm trying to rum the samples, but I'm getting the error "column unknown
ISADULT". I assume that it is a non-db property, cause its just reading de Age
field to define it's value. How can I solve this?
Original issue reported on code.google.com by [email protected]
on 30 Jan 2012 at 2:00
Currently you can't compile the unit tests and samples without CodeSite
Installed.
This item is to add support for SmartInspect and develop a solution to allow
developers to compile and run samples and unit tests without
CodeSite, or SmartInspect.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2012 at 4:36
Hello,
I am trying to run the HelloWorld sample with sqlite3 driver.
How does one create the required tables in dorm? (Many of the examples point to an existing DB with required tables)
Also, how does one create the required columns when the model changes?
Thanks
Rael
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.