db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Question on using enums.
Date Fri, 25 Nov 2005 08:51:05 GMT




Hi,

Assuming you mean java.util.enumeration:
As far as I know, enumerations are just an older version of
java.util.iterator. You would not want to store the iterator in the DB, you
usually store the underlying collection. This is in most cases modelled by
other tables referenced by a foreign key, which can be accessed in Torque
via a list.
Should you need other collection types, they would have to be hand-modelled
out of the list.

Assuming you mean the new jdk 1.5 enum type:
Sorry, JDK 1.5 specific features are not supported yet. You would have to
provide a custom mapper which maps the enum e.g. to an int. You would
probably do that best in a mapper class. Then, overload the getter and
setter method in the DB object class to accept the enum type, and map them
internally to the int value, which is then stored in the database.
Deprecate the original getters and setters to prevent the user from using
them (I would guess throwing exceptions in the original methods is no good,
as they are needed internally by Torque).

      Thomas


"Christian Stamm" <stammi@Mathematik.Uni-Marburg.de> schrieb am 24.11.2005
21:24:13:

> Hi,
>
> I didn't find any documentation on how to declare enumerations in
> project-schema.xml. If anyone could post example, that would be fine.
>
> Consider this as a noob question, so examples on usage would be also
> appreciated.
>
> thx
> Christian Stamm
>
> P.S.: After working a little with torque, I'm absolutely impressed. Nice
> work!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Mime
View raw message