You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Matthew Adams <ma...@matthewadams.me> on 2009/10/21 21:28:02 UTC

SOLVED (was: Re: Persistent interfaces & custom value handler)

@ElementStrategy

On Wed, Oct 21, 2009 at 10:10 AM, Matthew Adams <ma...@matthewadams.me> wrote:
> Perhaps this is a more direct way of asking the question:
>
> How do we tell OpenJPA that whenever it encounters a single- or
> multi-valued field of one of our persistent interface types, use our
> value handler?
>
> We currently use the @Strategy annotation on single-valued fields,
> which is ok, but (1) it doesn't work on multi-valued fields, and (2)
> we'd like to specify it across all entities without having to go to
> place the annotation on each field individually.
>
> On Wed, Oct 21, 2009 at 9:12 AM, Matthew Adams <ma...@matthewadams.me> wrote:
>> Hi all,
>>
>> We make use of persistent interfaces in our object model.  All of our
>> entities have a Long id, including all implementations of all
>> persistent interfaces, so we'd like to map any field that refers to a
>> persistent interface to two columns, one for the id value and one for
>> the implementation class name.  Our custom value handler is working
>> nicely for single-valued fields, but it is not treating collection of
>> an interface correctly.  Instead of OpenJPA iterating the collection
>> and calling our custom value handler, it is passing the collection
>> itself to our value handler.
>>
>> Question:  how do configure OpenJPA that whenever it encounters an
>> object of a given type, whether it be in a single- or multi-valued
>> field, to use a specific value handler?
>>
>> If we can't do that, how do we implement a value handler that handles
>> collection fields of types that need to have custom value handlers?
>>
>> Thanks,
>> Matthew
>>
>
>
>
> --
> mailto:matthew@matthewadams.me
> skype:matthewadams12
> yahoo:matthewadams
> aol:matthewadams12
> google-talk:matthewadams12@gmail.com
> msn:matthew@matthewadams.me
> http://matthewadams.me
> http://www.linkedin.com/in/matthewadams
>



-- 
mailto:matthew@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@gmail.com
msn:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams