ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Forward <dan-nab...@forwardhome.com>
Subject Mapping a Complex Object
Date Tue, 29 Dec 2009 23:22:37 GMT

I am new to iBATIS and I am having difficulty mapping our User object, which
consists of several custom objects, some of which span multiple columns in
the database. However, all the data for the user is stored in one table.

These are the properties of my User object:

private UserID id;
private Name name;
private Gender gender;
private EmailAddress email;
private TelephoneNumber phone;
private LocalDate birthDate;
private Hash passwordHash;
private StaticFileID avatarID;
private OrganizationID organizationID;
private int version;

The database schema looks like this:

create table user (
    id char(22) not null,
    first_name varchar(255),
    middle_name varchar(255),
    last_name varchar(255),
    suffix varchar(255),
    gender enum('Male', 'Female'),
    email varchar(255),
    phone char(14),
    birth_date date,
    password_hash char(22),
    avatar_id char(22),
    organization_id char(22),
    version int(11),
    primary key (id),
    unique key (email)
)

I think I can handle the single-column values by implementing
TypeHandlerCallback, but I am baffled how to handle the Name object, which
consists of four columns. Any help would be very much appreciated.
-- 
View this message in context: http://old.nabble.com/Mapping-a-Complex-Object-tp26961927p26961927.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


Mime
View raw message