Not really a preferred way - it's going to be up to you to decide if
you want code or configuration.

I think a row handler might be the best option in this case. So you
would have ibatis mapping all of your results to a Map, then in your
RowHandler, you'd take that row, and create the entity object, pluck
out the fixed values, then copy the rest to your entity's attributes
map.

You could probably create a RowHandler<Entity> sort of solution to do
that in a more general manner which would eliminate some redundant
code.

Sounds like it'd be a fun project. :)

Larry


On Thu, Dec 17, 2009 at 5:20 AM, Kristian Rink <li...@zimmer428.net> wrote:
> Larry Meadors schrieb:
>>
>> Interesting idea - so you end up with something like this?
>>
>> myEntity.id
>> myEntity.name
>> myEntity.attributes.someField
>> myEntity.attributes.someOtherField
>
> Yes, that's basically what it is supposed to be. Reason for this: We're, in
> the backend, using a legacy (proprietary :( ) document management system
> which has a somewhat "dynamic" RDBMS database / table structure which is
> subject to extension pretty often, so, asides a couple of "fixed" values
> (id, name, ...), the "dynamic" approach of having everything else in a Map
> or a Properties object so far has proven to be the most straightforward
> solution.
>
>
>> You could do that, but since you're doing "select *" you'd have to do
>> it with a result map or row handler.
>
> Hmmm... is there a "preferred way among these both and/or quick howtos? I
> already stumbled across the RowHandler but, so far, am unsure how to
> correctly apply this one... I'm using iBatis in a Spring 2.x environment,
> btw. :)
>
> TIA and all the best,
> Kristian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to