Re: java 1.5 enum types and EOs
Re: java 1.5 enum types and EOs
- Subject: Re: java 1.5 enum types and EOs
- From: "Ricardo J. Parada" <email@hidden>
- Date: Wed, 28 Jan 2009 15:41:03 -0500
Unfortunately I'm not cool enough for this project as it's not using
ERPrototypes (yet). :-)
However I did look at the javaEnum prototype in the entities defined
in the ERPrototypes framework and it seems like it actually maps it to
a string in the database. Again, I'm not using ERPrototypes so I
couldn't confirm.
Mapping an enum to a string in the database may take a few more
characters but you probably don't need to worry about updating the
values in the database if you decide to add a value to your enum
values so that their ordinal values are different. But you do have to
worry about if you rename an enum value I guess.
On Jan 28, 2009, at 2:36 PM, Stamenkovic Florijan wrote:
Sure... I store an int in the database that indicates the
enumeration element's ordinal (zero indexed sequence number), and
that's it... Straightforward and cool.
Which is I guess exactly what ERPrototypes automates for you, though
I have not tried it...
F
On Jan 27, 2009, at 18:18, Ricardo J. Parada wrote:
Has anybody explored using java 1.5 enum type for an EO's
property? Is there an easy way to do this?
For example, let's say I have a UserRequest EO and I wanted to have
the following statuses:
public enum Status { Draft, Ready, InProgress, Done };
How would the setStatus() and status() accessor methods should be
written and how should the property be setup in the eomodel?
Or should I stick with using an Integer property and hard code the
integer values for each status? :-)
Thanks,
Ricardo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden