ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rink <li...@zimmer428.net>
Subject Re: working with "raw" map<k,v>s instead of entities?
Date Thu, 17 Dec 2009 12:36:59 GMT
Larry Meadors schrieb:
> Not really a preferred way - it's going to be up to you to decide if
> you want code or configuration.

I see. :)

> 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.

But as far as I investigated things by now, I will still have to, say, 
come up with some sort of mapping configuration telling which column 
(id/name) to be stored in which key/property in java.util.Map? I can't, 
like, in an sqlMap definition, "iterate" across all the columns found to 
make sure each column gets stored in a Map entry with the same key, like ...

	// pseudocode
	<resultMap id="mapResult" class="java.util.HashMap">
		<for "column" in "result.columns">
		   <property name="$column" columnName="$column"/>

... ? This would make this project drastically easier. ;)

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

Yes, that's what comes to mind here. But I'm not half-way there yet I 
guess. :)

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

Indeed. :/ The structure in this system, so far, has successfully kept 
me from applying virtually any kind of available O/R mapping in a 
meaningful way. OTOH however, the iBatis way is pretty straightforward 
and easy-to-explain I guess so not having hibernate in here is not all 
that bad after all. ;)


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

View raw message