ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Joy" <joshjd...@gmail.com>
Subject ibatis type handler, lazy load?
Date Tue, 01 Jul 2008 17:25:41 GMT
Hi,

Ok, I'll best to explain what I'm doing and maybe if someone can help
provide some suggestions or paths to explore...

We have various Java enums in our application, and on the database side
these enums are mapped to primary ids on the database.

For example, we can do something like Status.ACTIVE which on the db would
map to primary id 1.

In our code we want to use Status.ACTIVE everywhere, and then write a type
handler that when it comes time to interact with the database it converts it
to 1, and converts 1 to Status.ACTIVE.

The issue is that we don't want to hard code these ids in our type handler,
want to pull these ids from the database into some lookup map, which then
the typehandler can use to do the proper conversions.

So the issue is that there is a circular dependency, we rely on ibatis to
connect to the database, though the type handler itself needs a call to the
database to get the mappings of the enums to primary ids.

How have other people handled this?

Also we are using spring with ibatis.

Thanks,
Josh

Mime
View raw message