The G framework persistence layer is very impressing, and i have now
tried to write a code generator to generate business object classes
for the G framework.
"hbm2delphi for the G framework" is based on Hibernate, Apache Ant and
Freemarker scripts and can be downloaded from CodeCentral at
http://cc.codegear.com/Item/24693
Easy installation
* unzip Hibernate Tools and Ant
* Install Ant (http://ant.apache.org/manual/index.html)
* copy required jar files from Hibernate Tools to the project lib
folder
There are still some minor issues remaining, but the generated example
code for the InterBase 2007 example database (employee.gdb) compiles
fine using the G framework release alpha-2507.
I did not receive any bug reports for the basic version (which creates
plain Delphi source code) but i would be very happy about feeedback.
Kind regards,
Michael Justin
--
betasoft - Software for Delphi™ and for the Java™ platform
http://www55.pair.com/betasoft/
http://www.betabeans.de/
p.s. here is a small code example:
(**
* Country
*)
TCountry = class (TgIDObject)
private
FCountry: string;
FCurrency: string;
// getter methods
function GetCountry: string;
function GetCurrency: string;
function GetJobs: TgIdentityList;
function GetCustomers: TgIdentityList;
// setter methods
procedure SetCountry(const Value: string);
procedure SetCurrency(const Value: string);
published
// properties
property Country: string read GetCountry write SetCountry;
property Currency: string read GetCurrency write SetCurrency;
property Jobs: TgIdentityList read GetJobs;
property Customers: TgIdentityList read GetCustomers;
end;
...
{ TCountry }
function TCountry.GetCountry: string;
begin
Result := FCountry;
end;
function TCountry.GetCurrency: string;
begin
Result := FCurrency;
end;
function TCountry.GetJobs: TgIdentityList;
begin
ReturnListReference(Result, 'Job', TgIdentityList, TJob);
end;
function TCountry.GetCustomers: TgIdentityList;
begin
ReturnListReference(Result, 'Customer', TgIdentityList, TCustomer);
end;
procedure TCountry.SetCountry(const Value: string);
begin
FCountry := Value;
end;
procedure TCountry.SetCurrency(const Value: string);
begin
FCurrency := Value;
end;
Thanks for working on this project. We have received a number of
questions regarding G and existing databases. I'm getting an error
when I try to access your project from the CodeGear site, so I'll try
later.
I noticed the automatic read and write accessor methods produced by
hbm2delphi. In G, we do everything we can to avoid methods for read
and write accessors. Instead, we try to use specialized data types to
execute the side effects for us (as well as to determine the field
length of string data types). This makes our unit's interface section
more declarative and reduces the amount of code that needs to be
written, debugged and maintained. Of course, there are times when read
and write accessors are necessary (getters that cause the creation of
an object property, for example), but they are the exception rather
than the rule. Because of this, I'd recommend replacing the automatic
read and write accessor methods with local storage references in
hbm2delphi for the G Framework.
Let me know your thoughts, and thanks again!
Goog
On Jul 1, 3:08 am, michael.jus...@gmx.net wrote:
> Hello!
>
> The G framework persistence layer is very impressing, and i have now
> tried to write a code generator to generate business object classes
> for the G framework.
>
> "hbm2delphi for the G framework" is based on Hibernate, Apache Ant and
> Freemarker scripts and can be downloaded from CodeCentral at
>
> http://cc.codegear.com/Item/24693
>
> Easy installation
> * unzip Hibernate Tools and Ant
> * Install Ant (http://ant.apache.org/manual/index.html)
> * copy required jar files from Hibernate Tools to the project lib
> folder
>
> There are still some minor issues remaining, but the generated example
> code for the InterBase 2007 example database (employee.gdb) compiles
> fine using the G framework release alpha-2507.
>
> I did not receive any bug reports for the basic version (which creates
> plain Delphi source code) but i would be very happy about feeedback.
>
> Kind regards,
>
> Michael Justin
>
> --
> betasoft - Software for Delphi™ and for the Java™ platformhttp://www55.pair.com/betasoft/http://www.betabeans.de/