I'm just shooting in the dark here, but I wonder if you need to make
changes to the enhancer in addition to the metadatarepo..... then again its
quite early so I might be way off in left field.

On Tue, Jun 30, 2015 at 2:53 PM, Mark Struberg <[email protected]> wrote:

> Hi Rick!
>
> I’m trying to finally solve the long outstanding issue that our @Strategy
> and FieldStrategies configuration is pretty much broken. See
> https://issues.apache.org/jira/browse/OPENJPA-2341
> It is broken if the type you like to store is not Serializable. E.g.
> (taken from my current unit test):
>
>
> @Strategy("org.apache.openjpa.persistence.strategy.value.PrincipalValueStrategyHandler")
> private Principal user;
>
> This blows up because OpenJPA totally ignores this field (as it is not any
> of the spec defined types and the Strategy gets ignored). I was not able to
> get it working by adding @Basic (blows up complaining that the field is not
> Serializable), @Column (just ignored), @Persistent (complains about tons of
> other stuff).
>
> It ‚accidentially‘ works with Serializable classes because those get
> picked up as BASIC. Like joda and java8 LocalDate for example.
>
> But they are not really @Basic!
> If you take the sample above, then the representation of the instance in
> the entity has _nothing_ to do with the final representation in the
> database. That could e.g. simply store that info in a VARCHAR(20)
>
> I gonna attach my current wip to the JIRA.
>
> Not sure whether we should ty to cleanly sovle this or back up and just
> commit what I have now which at least works for Serializable fields.
>
> LieGrue,
> strub
>
>
> > Am 30.06.2015 um 21:22 schrieb Rick Curtis <[email protected]>:
> >
> > Any more context as to the problem you're running into/trying to solve?
> >
> > On Tue, Jun 30, 2015 at 11:31 AM, Mark Struberg <[email protected]>
> wrote:
> >
> >> Hi folks!
> >>
> >> I sense some chicken-egg proglem with FieldMapping and what field
> becomes
> >> a persistent column.
> >>
> >> The point is that only fields which have a valid FieldMapping will
> become
> >> a persistent column.
> >>
> >> Currently the main check - as far as I do understand so far - is in
> >> PersistenceMetaDataDefaults#getPersistenceStrategy.
> >> Only fields which have some specific mapping annotations
> >> (PersistenceMetaDataDefaults#_strats) or implement Serializable get
> >> automatically picked up. Other classes get totally ignored. Even if I
> >> explicitly have a @Strategy annotation on them or if I register global
> >> FieldStrategies.
> >>
> >> I cannot extend the _strats to @Strategy.class as
> >> PersistenceMetaDataDefaults is defined in openjpa-persistence but
> Strategy
> >> is only defined later in openjpa-persistence-jdbc.
> >>
> >> What we could possibly do is to extend _attrs with the @Column
> annotation
> >> class?
> >>
> >> Any other ideas?
> >>
> >> LieGrue,
> >> strub
> >
> >
> >
> >
> > --
> > *Rick Curtis*
>
>


-- 
*Rick Curtis*

Reply via email to