incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Breitenstein <>
Subject Re: Bean handling in 1:n relationships or joins
Date Wed, 07 Dec 2011 21:01:16 GMT
Hi Rainer!

I know it's not a full blown oo mapper and that was exactly the reason 
to give empire a chance after some painful hibernate experiences in past 
What about extending the getBeansList method to pass in a list of 
classes to support an OO mapping for lets say one hierarchy?

Consider we have an entity A and B
A (name)
B (whatever1, whatever2, FK_to_A)

In case we select, B.whatever1, B.whatever2 by a join it's really 
comfortable to operate on a list<object[A, B]> having all parameters 
properly filled instead of an FK which requires an additional select per 
I have not digged into the sources yet but I believe its not far from 
what currently exists, or am I wrong? Maybe we can add it to a 


Btw: thanks for the quick response.

Am 07.12.11 18:41, schrieb Rainer Döbele:
> Hi Jens,
> remember that Empire-db is not an OR-Mapper and it does nothing automatically.
> In exchange it gives you more control over what, when and how database operations are
> Even though beans can be used as data containers, they will not provide the same level
of functinality than a DBRecord does.
> Again I recommend to take a look at our examples empire-db-example-basic and empire-db-example-advanced.
> Regards
> Rainer
>> from: Jens Breitenstein []
>> to:
>> re: Bean handling in 1:n relationships or joins
>> Hi all!
>> I have to admit I am pretty new to empire-db but feel quite confortable
>> with it...
>> Finally I got the Bean mapping working for single tables and I now get
>> stuck in how to handle joins correctly...
>> Assume a simple relationship between a document and a user (where the
>> users-pk is part of the documents as fk to indicate a relation
>> "document
>> is owned by user").
>> Using the getBeanList method it seems only possible to convert a "root"
>> element (in my case the document) but not any referenced element
>> automatically?
>> If I am wrong can someone explain me how I can retrieve a "document"
>> having a fully instantiated "user" element instead of just an FK?
>> Or do I have to read the user record manually and the bean handling
>> does
>> not support joined objects at all?
>> thanks in advance
>> Jens

View raw message