You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2010/06/03 17:28:50 UTC
Map enum with AbstractValueHandler, but on multiple columns
Using OpenJPA 1.2.2 (I can't upgrade to 2.0.0 at this time).
I have several columns in various tables that are mapped with enum
types, using an AbstractValueHandler strategy in each case. In each of
those cases, the enum type is only used for that single column in that
table.
In my AbstractValueHandlers, I define the "map", "toObjectValue", and
"toDataStoreValue" methods. The last two are simple. In the "map"
method, I return an array of one Column object, specifying the column
name and type. It seems odd to specify a column name here, but it
works.
I now have a situation where a particular enum type is going to be used
in several columns in several tables. Am I going to have to make a list
of the column names in the various tables where this type is used and
return them from the "map" method? That can't be right. What are my
options for making this a little cleaner?
RE: Map enum with AbstractValueHandler, but on multiple columns
Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Thursday, June 03, 2010 8:29 AM
> To: users@openjpa.apache.org
> Subject: Map enum with AbstractValueHandler, but on multiple columns
>
> Using OpenJPA 1.2.2 (I can't upgrade to 2.0.0 at this time).
>
> I have several columns in various tables that are mapped with enum
> types, using an AbstractValueHandler strategy in each case. In each
of
> those cases, the enum type is only used for that single column in that
> table.
>
> In my AbstractValueHandlers, I define the "map", "toObjectValue", and
> "toDataStoreValue" methods. The last two are simple. In the "map"
> method, I return an array of one Column object, specifying the column
> name and type. It seems odd to specify a column name here, but it
> works.
>
> I now have a situation where a particular enum type is going to be
used
> in several columns in several tables. Am I going to have to make a
> list
> of the column names in the various tables where this type is used and
> return them from the "map" method? That can't be right. What are my
> options for making this a little cleaner?
Would this just be the EnumValueHandler?