ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick <ric...@gmail.com>
Subject Question on doing things the "Flat" way
Date Sat, 15 Nov 2008 13:43:07 GMT
I was going to mail this directly to a few of my buds, but figured
whatever the response is, it could be useful for others...

First the business requirements:
//hypothetical example for sake of this email:

1) Show a single person and their favorite cars and display the
person's rank of each car

2) Show multiple persons and their favorite cars and for each person
display the person's rank of their cars

The data model looks like:



Integer rank

So how do you guys  like to set up you value objects to represent the
scenarios in 1 and 2?

Some of you I know wouldn't like to have a
Collection<Car> favoriteCars in the Person object

Also, what do you do about the "Integer rank?"

Since "rank" is only one field, I'd consider adding it as a property
on Car. If there were a lot of properties (like imagine Date rankDate
, etc.) I might make a "CarRank" value object. Lets say you had the
latter (a "CarRank" object) - for you guys that do things flat how do
you return your object graph?  Would you return a Map with Person as
key, and the value as a List of Maps where "Car" is key and "CarRank"
object as value?

I tend to think in terms of adding collections to my objects as
properties, so this 'flat' concept is new to me, but I really want to
nail down this "flat" way of thinking so I can consider using it

Thanks for any feedback.

View raw message