digitalmars.D.announce - HibernateD and DDBC - ORM and DB abstraction layer for D
- Vadim Lopatin (23/23) Apr 03 2013 Hello!
- Nick Sabalausky (6/39) Apr 03 2013 Sounds cool.
- Vadim Lopatin (2/7) Apr 03 2013 Actually I'm using mysqln as backend. But I patched it, removing
- Nick Sabalausky (8/17) Apr 03 2013 Ahh, ok. In that case, I may diff the two and see about making "vibe.d
- Vadim Lopatin (6/19) Apr 03 2013 It would be the best solution, to include patch into upstream,
- Robert (13/35) Apr 03 2013 :-S The better way would be to just depend on a Stream interface
- Nick Sabalausky (15/32) Apr 05 2013 I fixed the NULL blob thing in the main mysql-native's master a few
- Suliman (2/2) Apr 06 2013 Should ORM be done as separate lib, or it's should become part of
- David (4/5) Apr 06 2013 Why do people want to pack everything into phobos... And better question
- Suliman (5/5) Apr 06 2013 Because people want standards. For example people want GUI for D,
- BLM768 (8/13) Apr 08 2013 At the same time, it's good to have some competition and
- Suliman (3/5) Apr 08 2013 It's not problem to have 2 realization. Base and alternative. To
- David (3/9) Apr 10 2013 I am looking forward to the date libphobos.a has 1GB in size and takes 5
- Vadim Lopatin (5/18) Apr 10 2013 std.* may include only interfaces, e.g. like in java.sql package.
- David (12/26) Apr 10 2013 So if the std. implementation has a PITA api, all other (probably better
- Vadim Lopatin (3/44) Apr 10 2013 I cannot find information about PITA. What is it? Is it included
- Vadim Lopatin (2/47) Apr 10 2013 OOPS. Found it in Urban Dictionary :)
- David (2/37) Apr 10 2013 Hehe :)
- Jacob Carlborg (5/26) Apr 03 2013 Seems to be fairly complex API. How about using some
- Vadim Lopatin (25/71) Apr 03 2013 I believe HibernateD follows convention-over-configuration
- Vadim Lopatin (20/20) Apr 03 2013 I don't see what to simplify in markup like this:
- Jacob Carlborg (22/41) Apr 04 2013 Is the attributes necessary at all? I would just go with:
- Jacob Carlborg (5/13) Apr 04 2013 Or:
- Vadim Lopatin (26/45) Apr 04 2013 In Hibernate, there are two modes of automatic extraction of
- Dicebot (11/13) Apr 04 2013 You may implement approach similar to one used in vibe.d
- Vadim Lopatin (81/94) Apr 05 2013 Implemented changes for better convention-over-configuration:
- Dicebot (2/8) Apr 05 2013 Something like this : http://dpaste.1azy.net/ad013e4ef ?
- Vadim Lopatin (3/11) Apr 05 2013 It's as I have already implemented it.
- Dicebot (5/17) Apr 05 2013 Why do you redefine constructor (it does exactly the same what
- Vadim Lopatin (11/29) Apr 05 2013 Thank you!
- Jacob Carlborg (6/64) Apr 05 2013 Why won't Nullable!(string) String work?
- Vadim Lopatin (6/10) Apr 05 2013 It's to reduce field size (eliminate unnecessary bool field from
- Vadim Lopatin (9/19) Apr 05 2013 Submitted fix to support @Transient.
- Jacob Carlborg (5/12) Apr 05 2013 I'm not sure, the current behavior perhaps. I think I would need to try
- Jacob Carlborg (9/18) Apr 05 2013 Aha, I see. I think you can use Nullable!(string, null). Look at the
- Vadim Lopatin (19/27) Apr 05 2013 As addition to fields, two more options supported:
- Jacob Carlborg (8/13) Apr 05 2013 If there's no better way you can always use __traits(compiles),
- Dicebot (16/29) Apr 05 2013 Quoting
- Vadim Lopatin (7/40) Apr 05 2013 I'm iterating through class members using __traits(allMembers,
- Dicebot (6/12) Apr 05 2013 Quoting vibe.d again :)
- Vadim Lopatin (2/16) Apr 05 2013 Thanks a lot! It looks like Vibe is a good source :)
- Vadim Lopatin (2/16) Apr 08 2013 Fixed property support.
- Kagamin (3/9) Apr 29 2013 Is it good to assume string is not null? For most scenarios
- David (3/13) Apr 29 2013 Null blows up your code, "" doesn't. Also it's a SQL thing, "NotNull"
- Kagamin (4/7) May 06 2013 Full SQL support is good to have. I question the decision to make
- Vadim Lopatin (12/19) May 07 2013 Current implementation looks consistent:
- Nick Sabalausky (5/10) May 21 2013 That's not true:
- Diggory (10/20) May 21 2013 Strings are slices which are a pointer and a length. I think a
- Nick Sabalausky (5/31) May 21 2013 Right, exactly. In other words, there *is* a difference between null and
- Vadim Lopatin (7/17) Apr 09 2013 Project status update:
- Vadim Lopatin (8/18) Apr 10 2013 DDBC/HibernateD Project status update
- Vadim Lopatin (5/15) Apr 12 2013 Project status update:
- Rory McGuire (2/20) Apr 12 2013
- kdmult (7/8) Apr 12 2013 It would be great if you publish the DUB package.
- kdmult (1/5) Apr 12 2013 Oops. It looks fixed. :-)
- Vadim Lopatin (56/64) Apr 12 2013 Trying to package DDBC.
- Vadim Lopatin (36/36) Apr 12 2013 Still cannot build library using DUB.
- David (2/42) Apr 12 2013 Try to move targetType one level higher?
- Vadim Lopatin (5/12) Apr 12 2013 Tried. Doesn't help. Changing of targetType to "library" instead
- michaelc37 (21/21) Apr 13 2013 First off; Awesome project (just discovered this).
- Vadim Lopatin (10/31) Apr 15 2013 It's possible to implement this feature, although it would
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (30/70) Apr 16 2013 Sorry, the library target types are still not fully implemented. But if
- Vadim Lopatin (5/10) Apr 17 2013 Hello,
- kdmult (8/9) Apr 17 2013 I have tried to generate a visuald project which depends on both.
- Vadim Lopatin (6/17) Apr 18 2013 I've fixed directory structure.
- Vadim Lopatin (4/4) Jun 19 2013 New version: v0.2.9
Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost HibernateD collects metadata from classes annotated with Hibernate-like UDAs. Simple properties of supported: you can annotate fields, D properties or getter+setter pairs in your class, of types string, byte, short, int, long, ubyte, ushort, uint, ulong, byte[], ubyte[], DateTime, Date, TimeOfDay; for non-nullable types to support Null value use Nullable! template. Embedded entities supported - you can embed properties from Embeddable object to Entity's table. OneToOne, OneToMany, ManyToOne, ManyToMany relations are supported. You can use Lazy! and LazyCollection! to support lazy loading of aggregates. You can query DB using subset of HQL (Hibernate Query Language). Look at project wiki and unittests for more info.
Apr 03 2013
On Wed, 03 Apr 2013 16:28:36 +0200 "Vadim Lopatin" <coolreader.org gmail.com> wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost HibernateD collects metadata from classes annotated with Hibernate-like UDAs. Simple properties of supported: you can annotate fields, D properties or getter+setter pairs in your class, of types string, byte, short, int, long, ubyte, ushort, uint, ulong, byte[], ubyte[], DateTime, Date, TimeOfDay; for non-nullable types to support Null value use Nullable! template. Embedded entities supported - you can embed properties from Embeddable object to Entity's table. OneToOne, OneToMany, ManyToOne, ManyToMany relations are supported. You can use Lazy! and LazyCollection! to support lazy loading of aggregates. You can query DB using subset of HQL (Hibernate Query Language). Look at project wiki and unittests for more info.Sounds cool. Can it be used with Vibe.d's system of asynchronous connections? If not, then perhaps a backend for mysql-native <https://github.com/rejectedsoftware/mysql-native/> could be added?
Apr 03 2013
Sounds cool. Can it be used with Vibe.d's system of asynchronous connections? If not, then perhaps a backend for mysql-native <https://github.com/rejectedsoftware/mysql-native/> could be added?Actually I'm using mysqln as backend. But I patched it, removing vibe dependancies. (Vibe connection replaced with standard one).
Apr 03 2013
On Wed, 03 Apr 2013 18:54:13 +0200 "Vadim Lopatin" <coolreader.org gmail.com> wrote:Ahh, ok. In that case, I may diff the two and see about making "vibe.d connections vs std connections" a configurable choice (with vibe.d dependency disableable via -version switch). Then perhaps HibernateD/DDBC users and direct mysql-native users can both benefit from whichever form they need. Plus that way you wouldn't need to be bothered with keeping a separate fork of mysqln in sync.Sounds cool. Can it be used with Vibe.d's system of asynchronous connections? If not, then perhaps a backend for mysql-native <https://github.com/rejectedsoftware/mysql-native/> could be added?Actually I'm using mysqln as backend. But I patched it, removing vibe dependancies. (Vibe connection replaced with standard one).
Apr 03 2013
On Wednesday, 3 April 2013 at 17:22:46 UTC, Nick Sabalausky wrote:It would be the best solution, to include patch into upstream, and use upstream mysqln in DDBC. Besides connection replacement, I've added some getters to retrieve resultset and parameters metadata from mysqln, to support NULL blobs, and some more fixes.Actually I'm using mysqln as backend. But I patched it, removing vibe dependancies. (Vibe connection replaced with standard one).Ahh, ok. In that case, I may diff the two and see about making "vibe.d connections vs std connections" a configurable choice (with vibe.d dependency disableable via -version switch). Then perhaps HibernateD/DDBC users and direct mysql-native users can both benefit from whichever form they need. Plus that way you wouldn't need to be bothered with keeping a separate fork of mysqln in sync.
Apr 03 2013
On Wednesday, 3 April 2013 at 17:22:46 UTC, Nick Sabalausky wrote:On Wed, 03 Apr 2013 18:54:13 +0200 "Vadim Lopatin" <coolreader.org gmail.com> wrote::-S The better way would be to just depend on a Stream interface and switch implementations by instantiating different classes. -> The used Stream interface would of course need to be factored out of vibe, ideally into the standard library. This would be way more flexible: Users of the library can use either implementation without even having to recompile the library. No additional runtime cost either. "-version" should not be used too liberally in my opinion, because it is really inflexible, especially when it comes to binary/shared libraries. Best regards, RobertAhh, ok. In that case, I may diff the two and see about making "vibe.d connections vs std connections" a configurable choice (with vibe.d dependency disableable via -version switch). Then perhaps HibernateD/DDBC users and direct mysql-native users can both benefit from whichever form they need. Plus that way you wouldn't need to be bothered with keeping a separate fork of mysqln in sync.Sounds cool. Can it be used with Vibe.d's system of asynchronous connections? If not, then perhaps a backend for mysql-native <https://github.com/rejectedsoftware/mysql-native/> could be added?Actually I'm using mysqln as backend. But I patched it, removing vibe dependancies. (Vibe connection replaced with standard one).
Apr 03 2013
On Wed, 03 Apr 2013 20:01:54 +0200 "Vadim Lopatin" <coolreader.org gmail.com> wrote:Besides connection replacement, I've added some getters to retrieve resultset and parameters metadata from mysqln, to support NULL blobs, and some more fixes.I fixed the NULL blob thing in the main mysql-native's master a few weeks ago. I'll take a look at the rest. On Thu, 04 Apr 2013 00:50:39 +0200 "Robert" <jfanatiker gmx.at> wrote::-S The better way would be to just depend on a Stream interface and switch implementations by instantiating different classes. -> The used Stream interface would of course need to be factored out of vibe, ideally into the standard library. This would be way more flexible: Users of the library can use either implementation without even having to recompile the library. No additional runtime cost either.That would indeed be more flexible, but I'm not sure I can imagine a reason to ever use anything besides phobos connections and vibe.d connections (but maybe I'm wrong?). Plus, hopefully phobos connections will eventually gain the ability to work like vibe.d connections and obviate the need for vibe.d to have it's own connections. So I'm not sure whether it would really be worth it."-version" should not be used too liberally in my opinion, because it is really inflexible, especially when it comes to binary/shared libraries.I wasn't talking about using -version to switch between implementations. Just to disable the dependency on vibe.d (which of course would also disable the *option* of using vibe.d connections).
Apr 05 2013
Should ORM be done as separate lib, or it's should become part of Phobos?
Apr 06 2013
Am 06.04.2013 14:35, schrieb Suliman:Should ORM be done as separate lib, or it's should become part of Phobos?Why do people want to pack everything into phobos... And better question why is it then also added to phobos (like curl, wtf)? But that's a different topic.
Apr 06 2013
Because people want standards. For example people want GUI for D, but most of the people agree that it would bad idea to create 10 different GUIs, and it's better have one official GUI. Look at .NET it's include most of things that developers need at real life. And it's one of reasons of it's popularity.
Apr 06 2013
On Saturday, 6 April 2013 at 12:50:19 UTC, Suliman wrote:Because people want standards. For example people want GUI for D, but most of the people agree that it would bad idea to create 10 different GUIs, and it's better have one official GUI. Look at .NET it's include most of things that developers need at real life. And it's one of reasons of it's popularity.At the same time, it's good to have some competition and alternative choices. For example, Ruby on Rails is the de facto standard for Ruby Web applications, but there are alternatives (and pretty decent ones at that). That's why I'm continuing to work on my own ORM library, which should still have a niche in SQLite-based applications because its API is designed to be lightweight and lazy.
Apr 08 2013
At the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 08 2013
Am 09.04.2013 08:27, schrieb Suliman:I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
On Wednesday, 10 April 2013 at 08:59:07 UTC, David wrote:Am 09.04.2013 08:27, schrieb Suliman:std.* may include only interfaces, e.g. like in java.sql package. Implementations not necessary in std. Can be third party libraries (e.g. like java JDBC drivers). But standard interfaces give benefits.I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
Am 10.04.2013 12:26, schrieb Vadim Lopatin:On Wednesday, 10 April 2013 at 08:59:07 UTC, David wrote:So if the std. implementation has a PITA api, all other (probably better approaches) are forced (forced because the user expects an api like this and will probably reject something better but with a different api) to use the same PITA api? This isn't a problem with low-level stuff, but it is something completly different with something as high-level as an ORM. Also an api change in the std. implementation forces *every* 3rd party module to be updated, which is insane, what about a 3 year old implementation which is basically done, everyone considers it stable, now the std. implementation makes a small change, thousands of project will stop working. This isn't a too big problem if the 3 year old implementation is still activly develeoped, but if it isn't ...Am 09.04.2013 08:27, schrieb Suliman:std.* may include only interfaces, e.g. like in java.sql package. Implementations not necessary in std. Can be third party libraries (e.g. like java JDBC drivers). But standard interfaces give benefits.I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
On Wednesday, 10 April 2013 at 10:35:44 UTC, David wrote:Am 10.04.2013 12:26, schrieb Vadim Lopatin:I cannot find information about PITA. What is it? Is it included into Phobos?On Wednesday, 10 April 2013 at 08:59:07 UTC, David wrote:So if the std. implementation has a PITA api, all other (probably better approaches) are forced (forced because the user expects an api like this and will probably reject something better but with a different api) to use the same PITA api? This isn't a problem with low-level stuff, but it is something completly different with something as high-level as an ORM. Also an api change in the std. implementation forces *every* 3rd party module to be updated, which is insane, what about a 3 year old implementation which is basically done, everyone considers it stable, now the std. implementation makes a small change, thousands of project will stop working. This isn't a too big problem if the 3 year old implementation is still activly develeoped, but if it isn't ...Am 09.04.2013 08:27, schrieb Suliman:std.* may include only interfaces, e.g. like in java.sql package. Implementations not necessary in std. Can be third party libraries (e.g. like java JDBC drivers). But standard interfaces give benefits.I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
On Wednesday, 10 April 2013 at 11:04:27 UTC, Vadim Lopatin wrote:On Wednesday, 10 April 2013 at 10:35:44 UTC, David wrote:OOPS. Found it in Urban Dictionary :)Am 10.04.2013 12:26, schrieb Vadim Lopatin:I cannot find information about PITA. What is it? Is it included into Phobos?On Wednesday, 10 April 2013 at 08:59:07 UTC, David wrote:So if the std. implementation has a PITA api, all other (probably better approaches) are forced (forced because the user expects an api like this and will probably reject something better but with a different api) to use the same PITA api? This isn't a problem with low-level stuff, but it is something completly different with something as high-level as an ORM. Also an api change in the std. implementation forces *every* 3rd party module to be updated, which is insane, what about a 3 year old implementation which is basically done, everyone considers it stable, now the std. implementation makes a small change, thousands of project will stop working. This isn't a too big problem if the 3 year old implementation is still activly develeoped, but if it isn't ...Am 09.04.2013 08:27, schrieb Suliman:std.* may include only interfaces, e.g. like in java.sql package. Implementations not necessary in std. Can be third party libraries (e.g. like java JDBC drivers). But standard interfaces give benefits.I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
Am 10.04.2013 13:06, schrieb Vadim Lopatin:On Wednesday, 10 April 2013 at 11:04:27 UTC, Vadim Lopatin wrote:Hehe :)On Wednesday, 10 April 2013 at 10:35:44 UTC, David wrote:OOPS. Found it in Urban Dictionary :)Am 10.04.2013 12:26, schrieb Vadim Lopatin:I cannot find information about PITA. What is it? Is it included into Phobos?On Wednesday, 10 April 2013 at 08:59:07 UTC, David wrote:So if the std. implementation has a PITA api, all other (probably better approaches) are forced (forced because the user expects an api like this and will probably reject something better but with a different api) to use the same PITA api? This isn't a problem with low-level stuff, but it is something completly different with something as high-level as an ORM. Also an api change in the std. implementation forces *every* 3rd party module to be updated, which is insane, what about a 3 year old implementation which is basically done, everyone considers it stable, now the std. implementation makes a small change, thousands of project will stop working. This isn't a too big problem if the 3 year old implementation is still activly develeoped, but if it isn't ...Am 09.04.2013 08:27, schrieb Suliman:std.* may include only interfaces, e.g. like in java.sql package. Implementations not necessary in std. Can be third party libraries (e.g. like java JDBC drivers). But standard interfaces give benefits.I am looking forward to the date libphobos.a has 1GB in size and takes 5 hours to compileAt the same time, it's good to have some competition and alternative choices.It's not problem to have 2 realization. Base and alternative. To have one base realization is always good for thous who need to be sure that it would not be abandoned.
Apr 10 2013
On 2013-04-03 16:28, Vadim Lopatin wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost HibernateD collects metadata from classes annotated with Hibernate-like UDAs. Simple properties of supported: you can annotate fields, D properties or getter+setter pairs in your class, of types string, byte, short, int, long, ubyte, ushort, uint, ulong, byte[], ubyte[], DateTime, Date, TimeOfDay; for non-nullable types to support Null value use Nullable! template. Embedded entities supported - you can embed properties from Embeddable object to Entity's table. OneToOne, OneToMany, ManyToOne, ManyToMany relations are supported. You can use Lazy! and LazyCollection! to support lazy loading of aggregates. You can query DB using subset of HQL (Hibernate Query Language). Look at project wiki and unittests for more info.Seems to be fairly complex API. How about using some convention-over-configuration. -- /Jacob Carlborg
Apr 03 2013
On Wednesday, 3 April 2013 at 18:36:16 UTC, Jacob Carlborg wrote:On 2013-04-03 16:28, Vadim Lopatin wrote:I believe HibernateD follows convention-over-configuration principles. As per Wikipedia article for convention-over-configuration, "The phrase essentially means a developer only needs to specify unconventional aspects of the application. For example, if there's a class Sale in the model, the corresponding table in the database is called “sales” by default. It is only if one deviates from this convention, such as calling the table “products_sold”, that one needs to write code regarding these names." At least, for most annotations in HibernateD, you don't need to specify parameters like table or columns names, their types, nullability, etc. By default, they are being generated automatically in reasonable way. Say, for " Entity class CustomerInfo {}" table name "customer_info" will be used. For field " Column int streetAddress;", column name "street_address" NOT NULL will be used. " Column Nullable!long flags;" will be NULL in DB. Unlike Hibernate, in HibernateD there is on option to treat all fields/properties/getters as entity properties automatically, even if not annotated. In HibernateD, at least Column annotation should present. Not sure it's a big problem. Where could convention-over-configuration be used in ORM API besides annotations?Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost HibernateD collects metadata from classes annotated with Hibernate-like UDAs. Simple properties of supported: you can annotate fields, D properties or getter+setter pairs in your class, of types string, byte, short, int, long, ubyte, ushort, uint, ulong, byte[], ubyte[], DateTime, Date, TimeOfDay; for non-nullable types to support Null value use Nullable! template. Embedded entities supported - you can embed properties from Embeddable object to Entity's table. OneToOne, OneToMany, ManyToOne, ManyToMany relations are supported. You can use Lazy! and LazyCollection! to support lazy loading of aggregates. You can query DB using subset of HQL (Hibernate Query Language). Look at project wiki and unittests for more info.Seems to be fairly complex API. How about using some convention-over-configuration.
Apr 03 2013
I don't see what to simplify in markup like this: Entity class User { Generated long id; Column string name; ManyToOne Customer customer; ManyToMany LazyCollection!Role roles; } Which translates to table definitions like CREATE TABLE user (id bigint not null primary key auto_increment, name varchar(255), customer_fk bigint foreign key references customer(id)); CREATE TABLE user_roles (user_fk bigint not null foreign key references user(id), role_fk int not null foreign key references role(id), primary key(user_fk, role_fk); ...
Apr 03 2013
On 2013-04-03 21:07, Vadim Lopatin wrote:I don't see what to simplify in markup like this: Entity class User { Generated long id; Column string name; ManyToOne Customer customer; ManyToMany LazyCollection!Role roles; } Which translates to table definitions like CREATE TABLE user (id bigint not null primary key auto_increment, name varchar(255), customer_fk bigint foreign key references customer(id)); CREATE TABLE user_roles (user_fk bigint not null foreign key references user(id), role_fk int not null foreign key references role(id), primary key(user_fk, role_fk); ...Is the attributes necessary at all? I would just go with: class User { long id; // always assume auto increment, primary key, not null and so on string name; Customer customer; // infer ManyToOne ManyToMany LazyCollection!Role roles; // I guess this cannot be inferred LazyCollection!Foo foos; // infer OneToMany } Perhaps for primitive types you could have: class User { Long id; String name; Int foo; } Note the capital letters. -- /Jacob Carlborg
Apr 04 2013
On 2013-04-04 11:01, Jacob Carlborg wrote:Perhaps for primitive types you could have: class User { Long id; String name; Int foo; } Note the capital letters.Or: Id id; -- /Jacob Carlborg
Apr 04 2013
On Thursday, 4 April 2013 at 09:01:16 UTC, Jacob Carlborg wrote:Is the attributes necessary at all? I would just go with: class User { long id; // always assume auto increment, primary key, not null and so on string name; Customer customer; // infer ManyToOne ManyToMany LazyCollection!Role roles; // I guess this cannot be inferred LazyCollection!Foo foos; // infer OneToMany } Perhaps for primitive types you could have: class User { Long id; String name; Int foo; } Note the capital letters.In Hibernate, there are two modes of automatic extraction of properties from clas: all fields or all getters/setters. Unless field or getter has no Transient annotation, it's considered as property. I can implement similar behavior. If class doesn't have class level annotations, we can treat it as Entity. But in this case it's impossible to find entity classes in modules. Currently, HibernateD accept list of classes and/or modules, to extract metadata from. If module is passed, how would we determine if some particular class in module is persistent or not? Either we have to import ALL classes of module as entities or only annotated. Having default ManyToOne for object field and OneToMany for array of objects is a good idea. It will be nice to define aliases like alias Nullable!long Long; The question is how to determine what members of class to treat as properties? Currently field, getter/setter pair, and property supported. What should be rule to choose which of them import as fields? Have a priority of property access functions and getters/setters over usual fields? Ignore private and protected members? BTW, having getField()/setField() looks like not a D way ( property should be used instead). Probably, I just can remove getters/setters support.
Apr 04 2013
On Wednesday, 3 April 2013 at 19:07:39 UTC, Vadim Lopatin wrote:I don't see what to simplify in markup like this: ...You may implement approach similar to one used in vibe.d http.rest and http.form modules. Some specific examples are described by Jacob, but, in general, in results in 3 configuration stages: 0) No configuration at all, all data is inferred from variable names and types according to some sane convention. 1) Convention configuration - you chose one convention to use for aggregate type introspection at compile-time. Few different pre-defined conventions exist. 2) Fine configuration using UDAs.
Apr 04 2013
On Thursday, 4 April 2013 at 09:54:48 UTC, Dicebot wrote:On Wednesday, 3 April 2013 at 19:07:39 UTC, Vadim Lopatin wrote:Implemented changes for better convention-over-configuration: - If no annotations on class level, Entity is assumed. - No required annotation for simple properties. Nullability is deduced from data type - Embedded annotation is not needed anymore - it's deduced from field's class Embeddable annotation - If no key field annotations specified in class ( Id, Generated, Generator) - property named "id" (if any) is considered to be a Generated primary key. - For Object fields ManyToOne is applied by default - For Object[] or LazyCollection!Object OneToMany is applied by default - OneToOne and ManyToOne are required, since cannot be deduced Following declarations are valid (comments describe ): // Entity assumed since no Embeddable annotation class User { long id; // Generated deduced from field name string name; // deduced NotNull Address address; // deduced Embedded from annotation of Address Customer customer; // deduced ManyToOne JoinColumn // annotation required, otherwise would be deduced as OneToMany ManyToMany Roles[] roles; } Embeddable // required for Embeddable class Address { String zip; // Null String state; // Null string streetAddress; // NotNull } // Entity assumed since no Embeddable annotation class Customer { int id; // Generated primary key - from field name string name;// NotNull Long flags; // Null - because it's Long - not long LazyCollection!User users; // OneToMany by default // annotation required, otherwise would be deduced as ManyToOne // JoinColumn is required on one of OneToOne sides OneToOne JoinColumn CustomerOptions customerOptions; } // Entity assumed class CustomerOptions { int id; // annotation required, otherwise would be deduced as ManyToOne OneToOne Customer customer; } // Entity assumed since no Embeddable annotation class Role { int id; // Generated string name; // NotNull // annotation required, otherwise would be deduced as OneToMany ManyToMany LazyCollection!User users; } Aliases added, to simple put uppercase Long instead of Nullable!long in code: alias Nullable!byte Byte; alias Nullable!ubyte Ubyte; alias Nullable!short Short; alias Nullable!ushort Ushort; alias Nullable!int Int; alias Nullable!uint Uint; alias Nullable!long Long; alias Nullable!ulong Ulong; alias Nullable!float Float; alias Nullable!double Double; alias Nullable!DateTime NullableDateTime; alias Nullable!Date NullableDate; alias Nullable!TimeOfDay NullableTimeOfDay; String (uppercase nullable version of string) is defined as struct wrapper around string field, with interface similar to Nullable! Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?I don't see what to simplify in markup like this: ...You may implement approach similar to one used in vibe.d http.rest and http.form modules. Some specific examples are described by Jacob, but, in general, in results in 3 configuration stages: 0) No configuration at all, all data is inferred from variable names and types according to some sane convention. 1) Convention configuration - you chose one convention to use for aggregate type introspection at compile-time. Few different pre-defined conventions exist. 2) Fine configuration using UDAs.
Apr 05 2013
On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?Something like this : http://dpaste.1azy.net/ad013e4ef ?
Apr 05 2013
On Friday, 5 April 2013 at 07:57:37 UTC, Dicebot wrote:On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:It's as I have already implemented it. http://dpaste.1azy.net/a0393ce23Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?Something like this : http://dpaste.1azy.net/ad013e4ef ?
Apr 05 2013
On Friday, 5 April 2013 at 09:26:30 UTC, Vadim Lopatin wrote:On Friday, 5 April 2013 at 07:57:37 UTC, Dicebot wrote:Why do you redefine constructor (it does exactly the same what default one) and prefer getter over raw alias this (thus adding necessity for opAssign)? Other than that looks pretty adequate match to desired behavior.On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:It's as I have already implemented it. http://dpaste.1azy.net/a0393ce23Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?Something like this : http://dpaste.1azy.net/ad013e4ef ?
Apr 05 2013
On Friday, 5 April 2013 at 09:36:04 UTC, Dicebot wrote:On Friday, 5 April 2013 at 09:26:30 UTC, Vadim Lopatin wrote:Thank you! It was copy+paste from std.typecons Nullable! Cleaned it up. Strange thing: this code doesn't work for me if _value is protected - somewhere in CTFE generated code. "_value is unaccessible" It's hard to define exact place where it fails (inside of mixin). Tried to write different code which uses String with private _value, but cannot reproduce the same error. Leaving public _value so far.On Friday, 5 April 2013 at 07:57:37 UTC, Dicebot wrote:Why do you redefine constructor (it does exactly the same what default one) and prefer getter over raw alias this (thus adding necessity for opAssign)? Other than that looks pretty adequate match to desired behavior.On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:It's as I have already implemented it. http://dpaste.1azy.net/a0393ce23Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?Something like this : http://dpaste.1azy.net/ad013e4ef ?
Apr 05 2013
On 2013-04-05 09:32, Vadim Lopatin wrote:Implemented changes for better convention-over-configuration: - If no annotations on class level, Entity is assumed. - No required annotation for simple properties. Nullability is deduced from data type - Embedded annotation is not needed anymore - it's deduced from field's class Embeddable annotation - If no key field annotations specified in class ( Id, Generated, Generator) - property named "id" (if any) is considered to be a Generated primary key. - For Object fields ManyToOne is applied by default - For Object[] or LazyCollection!Object OneToMany is applied by default - OneToOne and ManyToOne are required, since cannot be deduced Following declarations are valid (comments describe ): // Entity assumed since no Embeddable annotation class User { long id; // Generated deduced from field name string name; // deduced NotNull Address address; // deduced Embedded from annotation of Address Customer customer; // deduced ManyToOne JoinColumn // annotation required, otherwise would be deduced as OneToMany ManyToMany Roles[] roles; } Embeddable // required for Embeddable class Address { String zip; // Null String state; // Null string streetAddress; // NotNull } // Entity assumed since no Embeddable annotation class Customer { int id; // Generated primary key - from field name string name;// NotNull Long flags; // Null - because it's Long - not long LazyCollection!User users; // OneToMany by default // annotation required, otherwise would be deduced as ManyToOne // JoinColumn is required on one of OneToOne sides OneToOne JoinColumn CustomerOptions customerOptions; } // Entity assumed class CustomerOptions { int id; // annotation required, otherwise would be deduced as ManyToOne OneToOne Customer customer; } // Entity assumed since no Embeddable annotation class Role { int id; // Generated string name; // NotNull // annotation required, otherwise would be deduced as OneToMany ManyToMany LazyCollection!User users; }String (uppercase nullable version of string) is defined as struct wrapper around string field, with interface similar to Nullable! Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?Why won't Nullable!(string) String work? Looks much better know. I'm wondering though, if there need to be a way to indicate a regular instance variable that isn't a column. -- /Jacob Carlborg
Apr 05 2013
On Friday, 5 April 2013 at 08:53:56 UTC, Jacob Carlborg wrote:Why won't Nullable!(string) String work?It's to reduce field size (eliminate unnecessary bool field from Nullable!, but it's easy to support both cases.Looks much better know. I'm wondering though, if there need to be a way to indicate a regular instance variable that isn't a column.1) Any private, protected, package members are not columns. 2) Transient annotation may be applied to public member to say that it shouln't be persisted (like in Java)
Apr 05 2013
On Friday, 5 April 2013 at 09:22:17 UTC, Vadim Lopatin wrote:On Friday, 5 April 2013 at 08:53:56 UTC, Jacob Carlborg wrote:Submitted fix to support Transient. It can be used on class level as well. Currently, if module is passed to metadata extractor, only classes which have at least one HibernateD annotation are being imported. Alternative is to import all classes, skipping only ones marked with Transient. Which way is better?Why won't Nullable!(string) String work?It's to reduce field size (eliminate unnecessary bool field from Nullable!, but it's easy to support both cases.Looks much better know. I'm wondering though, if there need to be a way to indicate a regular instance variable that isn't a column.1) Any private, protected, package members are not columns. 2) Transient annotation may be applied to public member to say that it shouln't be persisted (like in Java)
Apr 05 2013
On 2013-04-05 11:44, Vadim Lopatin wrote:Submitted fix to support Transient. It can be used on class level as well. Currently, if module is passed to metadata extractor, only classes which have at least one HibernateD annotation are being imported. Alternative is to import all classes, skipping only ones marked with Transient. Which way is better?I'm not sure, the current behavior perhaps. I think I would need to try it out do have a proper answer. -- /Jacob Carlborg
Apr 05 2013
On 2013-04-05 11:22, Vadim Lopatin wrote:On Friday, 5 April 2013 at 08:53:56 UTC, Jacob Carlborg wrote:Aha, I see. I think you can use Nullable!(string, null). Look at the documentation, there's two Nullable: dlang.org/phobos/std_typecons.htmlWhy won't Nullable!(string) String work?It's to reduce field size (eliminate unnecessary bool field from Nullable!, but it's easy to support both cases.Right, didn't think of that. What about methods, can you have a method/property as a column?Looks much better know. I'm wondering though, if there need to be a way to indicate a regular instance variable that isn't a column.1) Any private, protected, package members are not columns.2) Transient annotation may be applied to public member to say that it shouln't be persisted (like in Java)Sounds good. -- /Jacob Carlborg
Apr 05 2013
On Friday, 5 April 2013 at 12:13:42 UTC, Jacob Carlborg wrote:As addition to fields, two more options supported: 1) Getter/setter pair: public T getSomeProperty(); public xxx setSomeProperty(T value); or public T isSomeProperty(); public xxx setSomeProperty(T value); treated as property with name 'someProperty' Second case is useful for boolean, to sound more natural Result type of setter doesn't matter. Both getter and setter should be defined, otherwise methods will be ignored. 2) Read/write property property T someProperty() { ... } property xxx someProperty(T value) { ... } treated as property with name 'someProperty' BTW, I don't know how to check if property is read/write in compile time.Right, didn't think of that. What about methods, can you have a method/property as a column?Looks much better know. I'm wondering though, if there need to be a way to indicate a regular instance variable that isn't a column.1) Any private, protected, package members are not columns.
Apr 05 2013
On 2013-04-05 16:03, Vadim Lopatin wrote:2) Read/write property property T someProperty() { ... } property xxx someProperty(T value) { ... } treated as property with name 'someProperty' BTW, I don't know how to check if property is read/write in compile time.If there's no better way you can always use __traits(compiles), something like this: __traits(compiles, { auto c = new Class; T v = c.someProperty; c.someProperty = T.init; }); Currently that will compile regardless of property or not. -- /Jacob Carlborg
Apr 05 2013
On Friday, 5 April 2013 at 15:20:06 UTC, Jacob Carlborg wrote:On 2013-04-05 16:03, Vadim Lopatin wrote:Quoting https://github.com/rejectedsoftware/vibe.d/blob/master/source/ ibe/http/restutil.d : template isPropertyGetter(T) { enum isPropertyGetter = (functionAttributes!(T) & FunctionAttribute.property) != 0 && !is(ReturnType!T == void); } template isPropertySetter(T) { enum isPropertySetter = (functionAttributes!(T) & FunctionAttribute.property) != 0 && is(ReturnType!T == void); }2) Read/write property property T someProperty() { ... } property xxx someProperty(T value) { ... } treated as property with name 'someProperty' BTW, I don't know how to check if property is read/write in compile time.If there's no better way you can always use __traits(compiles), something like this: __traits(compiles, { auto c = new Class; T v = c.someProperty; c.someProperty = T.init; }); Currently that will compile regardless of property or not.
Apr 05 2013
On Friday, 5 April 2013 at 15:52:43 UTC, Dicebot wrote:On Friday, 5 April 2013 at 15:20:06 UTC, Jacob Carlborg wrote:I'm iterating through class members using __traits(allMembers, T), then accessing member using _traits(getMember,T,memberName) I'm not sure which one of the members with the same name will be returned by getMember... Property getter and setter have the same name... Is there any better way to iterate through members of class?On 2013-04-05 16:03, Vadim Lopatin wrote:Quoting https://github.com/rejectedsoftware/vibe.d/blob/master/source/ ibe/http/restutil.d : template isPropertyGetter(T) { enum isPropertyGetter = (functionAttributes!(T) & FunctionAttribute.property) != 0 && !is(ReturnType!T == void); } template isPropertySetter(T) { enum isPropertySetter = (functionAttributes!(T) & FunctionAttribute.property) != 0 && is(ReturnType!T == void); }2) Read/write property property T someProperty() { ... } property xxx someProperty(T value) { ... } treated as property with name 'someProperty' BTW, I don't know how to check if property is read/write in compile time.If there's no better way you can always use __traits(compiles), something like this: __traits(compiles, { auto c = new Class; T v = c.someProperty; c.someProperty = T.init; }); Currently that will compile regardless of property or not.
Apr 05 2013
On Friday, 5 April 2013 at 16:41:53 UTC, Vadim Lopatin wrote:I'm iterating through class members using __traits(allMembers, T), then accessing member using _traits(getMember,T,memberName) I'm not sure which one of the members with the same name will be returned by getMember... Property getter and setter have the same name... Is there any better way to iterate through members of class?Quoting vibe.d again :) --- foreach( member; __traits(allMembers, T) ) { foreach( overload; MemberFunctionsTuple!(T, method) ) { ---
Apr 05 2013
On Friday, 5 April 2013 at 17:18:01 UTC, Dicebot wrote:On Friday, 5 April 2013 at 16:41:53 UTC, Vadim Lopatin wrote:Thanks a lot! It looks like Vibe is a good source :)I'm iterating through class members using __traits(allMembers, T), then accessing member using _traits(getMember,T,memberName) I'm not sure which one of the members with the same name will be returned by getMember... Property getter and setter have the same name... Is there any better way to iterate through members of class?Quoting vibe.d again :) --- foreach( member; __traits(allMembers, T) ) { foreach( overload; MemberFunctionsTuple!(T, method) ) { ---
Apr 05 2013
On Friday, 5 April 2013 at 17:18:01 UTC, Dicebot wrote:On Friday, 5 April 2013 at 16:41:53 UTC, Vadim Lopatin wrote:Fixed property support.I'm iterating through class members using __traits(allMembers, T), then accessing member using _traits(getMember,T,memberName) I'm not sure which one of the members with the same name will be returned by getMember... Property getter and setter have the same name... Is there any better way to iterate through members of class?Quoting vibe.d again :) --- foreach( member; __traits(allMembers, T) ) { foreach( overload; MemberFunctionsTuple!(T, method) ) { ---
Apr 08 2013
On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:Embeddable // required for Embeddable class Address { String zip; // Null String state; // Null string streetAddress; // NotNull }Is it good to assume string is not null? For most scenarios there's little difference between null and empty string.
Apr 29 2013
Am 29.04.2013 11:25, schrieb Kagamin:On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:Null blows up your code, "" doesn't. Also it's a SQL thing, "NotNull" must be initialized, when the row is filled.Embeddable // required for Embeddable class Address { String zip; // Null String state; // Null string streetAddress; // NotNull }Is it good to assume string is not null? For most scenarios there's little difference between null and empty string.
Apr 29 2013
On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:Null blows up your code, "" doesn't.There's no difference between null and empty string in D.Also it's a SQL thing, "NotNull" must be initialized, when the row is filled.Full SQL support is good to have. I question the decision to make it default.
May 06 2013
On Monday, 6 May 2013 at 09:14:57 UTC, Kagamin wrote:On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:Current implementation looks consistent: D type -- SQL type int -- INT NOT NULL Int -- INT NULL long -- BIGINT NOT NULL Long -- BIGINT NULL string -- VARCHAR(255) NOT NULL String -- VARCHAR(255) NULL Uppercase types are nullable. NotNull/ Null annotations are not required. Nullability can be inferred from type name.Null blows up your code, "" doesn't.There's no difference between null and empty string in D.Also it's a SQL thing, "NotNull" must be initialized, when the row is filled.Full SQL support is good to have. I question the decision to make it default.
May 07 2013
On Mon, 06 May 2013 11:14:56 +0200 "Kagamin" <spam here.lot> wrote:On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:That's not true: assert("" !is null); // Passes Or did I misunderstand what you meant?Null blows up your code, "" doesn't.There's no difference between null and empty string in D.
May 21 2013
On Tuesday, 21 May 2013 at 22:24:06 UTC, Nick Sabalausky wrote:On Mon, 06 May 2013 11:14:56 +0200 "Kagamin" <spam here.lot> wrote:Strings are slices which are a pointer and a length. I think a slice compares equal to null only if the pointer part is null. However, a slice with a null pointer and a length of zero is still a valid empty slice, which is slightly odd behaviour compared to other languages... An empty string literal initialises the pointer to non-null because string literals are null terminated, so the memory block actually has a length of one, even though the slice has length zero.On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:That's not true: assert("" !is null); // Passes Or did I misunderstand what you meant?Null blows up your code, "" doesn't.There's no difference between null and empty string in D.
May 21 2013
On Wed, 22 May 2013 02:10:52 +0200 "Diggory" <diggsey googlemail.com> wrote:On Tuesday, 21 May 2013 at 22:24:06 UTC, Nick Sabalausky wrote:Right, exactly. In other words, there *is* a difference between null and empty string in D (even though it's sometimes a clouded issue since '==' counts them as equal).On Mon, 06 May 2013 11:14:56 +0200 "Kagamin" <spam here.lot> wrote:Strings are slices which are a pointer and a length. I think a slice compares equal to null only if the pointer part is null. However, a slice with a null pointer and a length of zero is still a valid empty slice, which is slightly odd behaviour compared to other languages... An empty string literal initialises the pointer to non-null because string literals are null terminated, so the memory block actually has a length of one, even though the slice has length zero.On Monday, 29 April 2013 at 09:38:10 UTC, David wrote:That's not true: assert("" !is null); // Passes Or did I misunderstand what you meant?Null blows up your code, "" doesn't.There's no difference between null and empty string in D.
May 21 2013
On Wednesday, 22 May 2013 at 00:19:04 UTC, Nick Sabalausky wrote:Right, exactly. In other words, there *is* a difference between null and empty string in D (even though it's sometimes a clouded issue since '==' counts them as equal).I meant there's no difference between them in meaningful scenarios (where empty string and null behave the same). Your example is synthetic (its also unclear wheter you compare strings or void*'s). I wouldn't expect this behavior to be reliable as D doesn't need distinction between null and empty string.
Jun 25 2013
On Wednesday, 22 May 2013 at 00:19:04 UTC, Nick Sabalausky wrote:Right, exactly. In other words, there *is* a difference between null and empty string in D (even though it's sometimes a clouded issue since '==' counts them as equal).== compare value, is compare identity. Everything is fine on that one.
Jun 25 2013
On Wednesday, 3 April 2013 at 14:28:37 UTC, Vadim Lopatin wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost....Look at project wiki and unittests for more info.Project status update: Recent changes: - Better convention-over-configuration support: most of annotations are non-mandatory now, inferred from field types - Automatic creation of DB tables and indexes
Apr 09 2013
On Wednesday, 3 April 2013 at 14:28:37 UTC, Vadim Lopatin wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost Look at project wiki and unittests for more info.DDBC/HibernateD Project status update ===================================== SQLite support added into both DDBC and HibernateD. Use version identifier(s) USE_MYSQL, USE_SQLITE to enable corresponding DBs. Both SQLite and MySQL pass HibernateD unit tests. PostgreSQL support implementation is in progress.
Apr 10 2013
On Wednesday, 3 April 2013 at 14:28:37 UTC, Vadim Lopatin wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/hibernated/wiki/HibernateD/ License is Boost...Look at project wiki and unittests for more info.Project status update: PostgreSQL support is added to DDBC and HibernateD. Does anyone have an idea what to do next?
Apr 12 2013
:) nuodb. On Fri, Apr 12, 2013 at 9:08 AM, Vadim Lopatin <coolreader.org gmail.com>wrote:On Wednesday, 3 April 2013 at 14:28:37 UTC, Vadim Lopatin wrote:Hello! I've started implemetation of ORM in D, with annotations and interfaces similar to Hibernate. As DB abstraction layer I wrote DDBC - library with interface similar to JDBC. Only MySQL driver is implemented. PostgreSQL - in progress. Project is hosted on SourceForge: https://sourceforge.net/p/** hibernated/wiki/HibernateD/<https://sourceforge.net/p/hibernated/wiki HibernateD/>License is Boost ...Look at project wiki and unittests for more info.Project status update: PostgreSQL support is added to DDBC and HibernateD. Does anyone have an idea what to do next?
Apr 12 2013
Hi Vadim,Does anyone have an idea what to do next?It would be great if you publish the DUB package. Please refer to http://registry.vibed.org/publish. There is a hint. Page http://registry.vibed.org/ lists registered DUB packages. To see them you have to register and sign in there. Otherwise, you will see some product info page.
Apr 12 2013
There is a hint. Page http://registry.vibed.org/ lists registered DUB packages. To see them you have to register and sign in there. Otherwise, you will see some product info page.Oops. It looks fixed. :-)
Apr 12 2013
On Friday, 12 April 2013 at 09:03:56 UTC, kdmult wrote:Hi Vadim,Trying to package DDBC. https://github.com/buggins/ddbc dub build fails. It looks like it tries to build application instead of library, although I specified "targetType": "staticLibrary", Checking dependencies in '/home/lve/src/ddbc' Building configuration "MySQL", build type debug Running dmd (compile)... Linking... /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_47f_1a5.o): In function `main': src/rt/dmain2.d:(.text.main+0xa): undefined reference to `_Dmain' /usr/lib/x86_64-linux-gnu/libphobos2.a(thread_1a1_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread': src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFZC4core6 hread6Thread+0x26): undefined reference to `_tlsend' src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFZC4core6 hread6Thread+0x31): undefined reference to `_tlsstart' /usr/lib/x86_64-linux-gnu/libphobos2.a(deh2_45f_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable': .... src/core/thread.d:(.text.thread_entryPoint+0xb0): undefined reference to `_tlsstart' collect2: error: ld returned 1 exit status --- errorlevel 1 Error: no main function specified Error: Link command failed with exit code 1 { "name": "DDBC", "description": "DB Connector for D language, similar to JDBC", "authors": ["Vadim Lopatin"], "homepage": "http://sourceforge.net/projects/ddbc", "license": "Boost Software License (BSL 1.0)", "dependencies": { }, "targetType": "staticLibrary", "configurations": [ { "name": "MySQL", "versions": ["USE_MYSQL"] }, { "name": "SQLite", "versions": ["USE_SQLITE"], "libs-posix": ["sqlite3"], "libs-windows": ["sqlite3.lib"] }, { "name": "PGSQL", "versions": ["USE_PGSQL"], "libs-posix": ["pq"], "libs-windows": ["libpq.lib"] } ] }Does anyone have an idea what to do next?It would be great if you publish the DUB package. Please refer to http://registry.vibed.org/publish. There is a hint. Page http://registry.vibed.org/ lists registered DUB packages. To see them you have to register and sign in there. Otherwise, you will see some product info page.
Apr 12 2013
Still cannot build library using DUB. Tried different changes in package.json dub -v ... [7F6FC283306F:00000000 INF] Running dmd (compile)... [7F6FC283306F:00000000 dbg] dmd -w -g -debug -c -oftemp.o -version=USE_MYSQL -I/home/lve/src/ddbc/source source/drivers/sha1.d source/drivers/pgsqlddbc.d source/drivers/pgsql.d source/drivers/mysqlddbc.d source/drivers/mysql.d source/drivers/utils.d source/drivers/sqliteddbc.d source/common.d source/core.d [7F6FC283306F:00000000 INF] Linking... [7F6FC283306F:00000000 dbg] dmd -of/tmp/dub/2946988246/libddbc.a temp.o /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_47f_1a5.o): In function `main': Why does it try to link app executable instead of just link library? package.json: { "name": "DDBC", "description": "DB Connector for D language, similar to JDBC", "authors": ["Vadim Lopatin"], "homepage": "http://sourceforge.net/projects/ddbc", "license": "Boost Software License (BSL 1.0)", "sourcePaths": ["source", "source/drivers"], "configurations": [ { "name": "MySQL", "versions": ["USE_MYSQL"], "targetType": "staticLibrary", "targetPath": "bin", "targetName": "ddbc", } ] }
Apr 12 2013
Am 12.04.2013 15:17, schrieb Vadim Lopatin:Still cannot build library using DUB. Tried different changes in package.json dub -v ... [7F6FC283306F:00000000 INF] Running dmd (compile)... [7F6FC283306F:00000000 dbg] dmd -w -g -debug -c -oftemp.o -version=USE_MYSQL -I/home/lve/src/ddbc/source source/drivers/sha1.d source/drivers/pgsqlddbc.d source/drivers/pgsql.d source/drivers/mysqlddbc.d source/drivers/mysql.d source/drivers/utils.d source/drivers/sqliteddbc.d source/common.d source/core.d [7F6FC283306F:00000000 INF] Linking... [7F6FC283306F:00000000 dbg] dmd -of/tmp/dub/2946988246/libddbc.a temp.o /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_47f_1a5.o): In function `main': Why does it try to link app executable instead of just link library? package.json: { "name": "DDBC", "description": "DB Connector for D language, similar to JDBC", "authors": ["Vadim Lopatin"], "homepage": "http://sourceforge.net/projects/ddbc", "license": "Boost Software License (BSL 1.0)", "sourcePaths": ["source", "source/drivers"], "configurations": [ { "name": "MySQL", "versions": ["USE_MYSQL"], "targetType": "staticLibrary", "targetPath": "bin", "targetName": "ddbc", } ] }Try to move targetType one level higher?
Apr 12 2013
On Friday, 12 April 2013 at 13:22:41 UTC, David wrote:[7F6FC283306F:00000000 INF] Linking... [7F6FC283306F:00000000 dbg] dmd -of/tmp/dub/2946988246/libddbc.a temp.oWhy does it try to link app executable instead of just link library?Try to move targetType one level higher?Tried. Doesn't help. Changing of targetType to "library" instead of "staticLibrary" doesn't help, too. Link command is always the same: dmd -of/tmp/dub/2946988246/libddbc.a temp.o
Apr 12 2013
First off; Awesome project (just discovered this). Is it possible set up the mapping externally in some sort of xml configuration file (without using attributes)right now? If not, is it planned for future? The reason i ask is because i started playing around with nhibernate recently, and really like the fact that i did not have to polute(for lack of a better term) the code file with attributes. e.g. <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Something.Core" namespace="Something.Core.Data.Models"> <class name="User"> <id name="Id"> <generator class="native"></generator> </id> <property name="FirstName" /> <property name="LastName" /> </class> </hibernate-mapping>
Apr 13 2013
On Saturday, 13 April 2013 at 16:23:04 UTC, michaelc37 wrote:First off; Awesome project (just discovered this). Is it possible set up the mapping externally in some sort of xml configuration file (without using attributes)right now? If not, is it planned for future? The reason i ask is because i started playing around with nhibernate recently, and really like the fact that i did not have to polute(for lack of a better term) the code file with attributes. e.g. <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Something.Core" namespace="Something.Core.Data.Models"> <class name="User"> <id name="Id"> <generator class="native"></generator> </id> <property name="FirstName" /> <property name="LastName" /> </class> </hibernate-mapping>It's possible to implement this feature, although it would require compile-time XML parsing. But I don't see big benefits from it. It's inconvenient and error prone. Properties of the same entity should be edited in two separate files, and kept in sync. Historically, XML annotations were replaced with annotations in JPA/Hibernate once Java got support of annotations. Even XML files were usually generated automatically from JavaDoc annotations inside comments.
Apr 15 2013
Sorry, the library target types are still not fully implemented. But if the package is used as a dependency instead of being directly built, it will be properly used as a library instead of as an executable. I would go with the following minimal package description for now (the source folder and targetType="library" is inferred automatically): { "name": "DDBC", "description": "DB Connector for D language, similar to JDBC", "authors": ["Vadim Lopatin"], "homepage": "http://sourceforge.net/projects/ddbc", "license": "Boost Software License (BSL 1.0)", "configurations": [ { "name": "MySQL", "versions": ["USE_MYSQL"] } ] } However, there is one issue: The package registry needs to get either sourceforge.net support, or support to upload arbitrary files (which is difficult in the long term because of disk space usage). But even without that support, the package can be used for now using: $ svn co ... hibernated $ dub add-local hibernated ~master with other projects adding it to their package description with: { "dependencies": {"hibernated": "~master"} } I'll try to get the missing things sorted out shortly. Am 12.04.2013 15:17, schrieb Vadim Lopatin:Still cannot build library using DUB. Tried different changes in package.json dub -v ... [7F6FC283306F:00000000 INF] Running dmd (compile)... [7F6FC283306F:00000000 dbg] dmd -w -g -debug -c -oftemp.o -version=USE_MYSQL -I/home/lve/src/ddbc/source source/drivers/sha1.d source/drivers/pgsqlddbc.d source/drivers/pgsql.d source/drivers/mysqlddbc.d source/drivers/mysql.d source/drivers/utils.d source/drivers/sqliteddbc.d source/common.d source/core.d [7F6FC283306F:00000000 INF] Linking... [7F6FC283306F:00000000 dbg] dmd -of/tmp/dub/2946988246/libddbc.a temp.o /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_47f_1a5.o): In function `main': Why does it try to link app executable instead of just link library? package.json: { "name": "DDBC", "description": "DB Connector for D language, similar to JDBC", "authors": ["Vadim Lopatin"], "homepage": "http://sourceforge.net/projects/ddbc", "license": "Boost Software License (BSL 1.0)", "sourcePaths": ["source", "source/drivers"], "configurations": [ { "name": "MySQL", "versions": ["USE_MYSQL"], "targetType": "staticLibrary", "targetPath": "bin", "targetName": "ddbc", } ] }
Apr 16 2013
On Tuesday, 16 April 2013 at 07:41:04 UTC, Sönke Ludwig wrote:Sorry, the library target types are still not fully implemented. But if the package is used as a dependency instead of being directly built, it will be properly used as a library instead of as an executable.Hello, I've sent pull request with fix. At least this fix resolves ddbc build issue. P.S: I've registered ddbc and hibernated in DUB repository.
Apr 17 2013
P.S: I've registered ddbc and hibernated in DUB repository.I have tried to generate a visuald project which depends on both. There is a couple of issues. 1. Since you use prefix hibernated (for example, hibernated.core) there should be subfolder hibernated under source. And the source code should go there. 2. In dependencies I was forced to use version "~master" instead of a certain version. Is there a simple example of using hibernated with sqlite driver?
Apr 17 2013
On Wednesday, 17 April 2013 at 13:46:30 UTC, kdmult wrote:I've fixed directory structure. You need to use SQLite config for both DDBC and HibernateD (USE_SQLITE version code defined). Look at unittests for sample usage (hibernated.tests module). You need sqlite .lib and .dll to build under windows.P.S: I've registered ddbc and hibernated in DUB repository.I have tried to generate a visuald project which depends on both. There is a couple of issues. 1. Since you use prefix hibernated (for example, hibernated.core) there should be subfolder hibernated under source. And the source code should go there. 2. In dependencies I was forced to use version "~master" instead of a certain version. Is there a simple example of using hibernated with sqlite driver?
Apr 18 2013
New version: v0.2.9 Fixed HQL parser bug with underscores in field and table names Fixed compilation error with undefined identifiers in metadata.d Merged pull request to use standard mysql-native library
Jun 19 2013