ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Wolf" <joe.w...@compsciresources.com>
Subject Re: ibatis and best practices
Date Fri, 03 Mar 2006 20:49:45 GMT
I use maps a lot for inserts and queries since I'm working with a database 
and data model that are pretty disparate; as a result, when I do inserts, I 
need to provide additional data that's not a part of my POJO.  For example,

my.pojo.Entity {
  Long entityId;
  Set addresses;
}
my.pojo.Address {
  Long addressId;
}

Address table in DB:
EntityID NUMERIC NOT NULL
AddressID NUMERIC NOT NULL

So when I do an address insert, I end up putting all the address info in a 
map along with the entityId.  Maybe there's a better way...  I don't use 
maps for results sets because I can usually join the tables well enough to 
get all the data I need to populate my POJOs.

-Joe

----- Original Message ----- 
From: "Nathan Maves" <Nathan.Maves@Sun.COM>
To: <user-java@ibatis.apache.org>
Sent: Friday, March 03, 2006 2:40 PM
Subject: Re: ibatis and best practices


> In general a think that only using a java.util.Map when it is a must  is 
> considered a best practice.
>
> Why not use a resultMap to map your results to your POJO.  That is  what 
> this framework was designed for?
>
> Natha
> On Mar 3, 2006, at 12:15 PM, Ashish Kulkarni wrote:
>
>> Hi
>> Recently i had asked question about designing java
>> classes for resultset,
>> So if i have desgined my java classes as per my
>> requirement, and using java.util.HashMap to get result
>> using ibatis, and then in my java program loading
>> values from HashMap in my java class,
>> am i not making the process slow by adding additional
>> layer?
>>
>> Ashish
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam?  Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>
> 



Mime
View raw message