ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thibaut Fagart <thibaut.fag...@hsbc.fr>
Subject howto : Degenerated case of heterogenous lists.
Date Wed, 14 Feb 2007 14:51:24 GMT

I'm currently evaluating IBatis for the corporation I work with, and trying
to use it to solve a case we have.

We have a model like this

Customer {
	firstName : string
	lastName : string
	address1 : Address
	address2 : Address
	address3 : Address
where Address is a simple class.

All the addresses happen to be stored in the same table, with a join to the
customer table, and a flag indicating which address this is (address1,
address2 or address3).

The request that used to be used to solve this case is something like that

select [customer columns], [address columns], address_flag  from customer,
where customer.id = address.id_customer

This would return 3 rows, with the curstomer information duplicated, and the
resultSet consuming code would sort out which address attributes (address1,
address2 or address3) has to be set with the current row depending on
address_flag value.

I've seen support for returning heterogenous lists using the discriminator
tag, but this doesn't solve my problem, does it ?

Would there be a way to solve this case with only 1 request to the database
View this message in context: http://www.nabble.com/howto-%3A-Degenerated-case-of-heterogenous-lists.-tf3227674.html#a8966314
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message