You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Rainer Döbele <do...@esteam.de> on 2008/10/12 22:51:32 UTC

Re: Empire-db

Hi Niclas,
 
first of all I appreciate that you consider Empire-db for your Qi4j project.
Even though I have read your question a couple of times, I am not sure whether I fully understand your needs.
 
First of all Empire-db can shield you from RDBMS nuances and it does not require you to use any POJO or Jababean Objects. It does however not use (nor require) reflection and I cannot figure out why you would need that.
 
Refering to your sample code, Empire-db can help you for example to build the statement needed to obtain the ResultSet, dynamically and by using API calls instead of cumbersome and error prone string assembly.
I am not sure where your SqlMapping.class comes from but in our domain this would relate to a Column object that contails metadata about a table column. Other than with your code however, we would not use the column name to identify the data in the resultset but the Column object itself.
 
Another thing that might be convenient for you, is that Empire-db allows data model changes at runtime while still offering identity management and optimistic locking for records of the affected tables. This however is only relevant if the properties of an entiy can change at runtime.
 
In order to find out, whether and how Empire-db can be beneficial for you I would recommend to have a look and run the two sample applications (DBSample and DBSampleAdv) that are provided with the Empire-db distribution.
Please use the following latest release approved by the incubator PMC:
http://people.apache.org/~reiher/Empire-db-incubating/
 
If you have further questions I am happy to help.
Best regards
 
Rainer

Niclas Hedhman wrote:
> Hi,
> I am so-so active on the Apache Incubator, and today decided to look
> at Empire-db, just out of curiosity really.
> 
> But, I also work heavily on another project, Qi4j
> (http://www.qi4j.org <http://www.qi4j.org/> ), and we are looking at RDBMS support in there,
> and I wonder if Empire-db can be more helpful than iBatis, which is
> the current way to handle it.
> 
> In essence,
> Does Empire-db have any reflective tools at all?
> 
> That perhaps require some further explanation.
> In Qi4j, the domain model drives everything, and we have our own
> abstraction of what an EntityStore is. To create an EntityStore that
> uses RDBMS is a piece of cake if I only store 4 columns (ID, data,
> instance_version, class_version). But, the real challenge is when the
> RDBMS system already exist, and we need to do the "ORM" dance. I know
> what you feel about ORM, and I don't want that debate. Note-worthy
> though, is that Qi4j do not use POJOs or Javabeans in any form or
> fashion. Instead our "ORM" is cleanly separated out, so that the
> EntityStore only gets "Properties", "Associations" and
> "ManyAssociations" handed to it per Identity, and only need to store
> those "as-is" and no traversing et al. So, for Property (a class in
> its own right in Qi4j), we need to locate or store the value from a
> Column in a Row corresponding to the Identity of the Entity. So, can I
> use Empire-db to do the above reflectively?? I.e.
> 
> ResultSet set = st.execute(....);
> Property[] properties = ... ;
> for( Property prop : properties )
> {
>     // We have custom meta info on properties, like this
>     String column = prop.metaInfo( SqlMapping.class ).columnName();
> 
>     // retrieve the column and set the value
>     prop.set( set.getString( column ) );
> }
> 
> Of course, the above code only works for String, and all other
> discrete types must be dealt with individually.
> 
> 
> What I am looking for from Empire-db, is shielding me from RDBMS
> nuances, such as syntax differences (probably not much) and types.
> Your type-safety system == EXCELLENT, but not something that we need.
> Qi4j is at the same level in that respect, 100% type-safe.
> 
> 
> Cheers
> Niclas