Have you looked through org.apache.openjpa.meta.AbstractMetaDataDefaults <eclipse-javadoc:%E2%98%82=openjpa-kernel/src%5C/main%5C/java%3Corg.apache.openjpa.meta%7BAbstractMetaDataDefaults.java%E2%98%83AbstractMetaDataDefaults>.populateFromReflection(...) ?
On Wed, Jul 1, 2015 at 8:04 AM, Mark Struberg <[email protected]> wrote: > Indeed the enhancer is involved in the game. > But I had hoped to _not_ need to change the enhancer itself. It just needs > to pickup the field as persistent. > > At the end what I like to achieve is that those fields are really handled > the same like PersistenceStrategy.BASIC. > With the only difference that a @Basic field currently needs to be > Serializable. This check is done pretty early - even before the > FieldStrategies get parsed. So we might be fine to fully remove this check > or at least somehow postpone it to a later stage and skip the check if we > know if a Strategy/ValueHandler is applied to this field. At least I have > no better idea at this moment ;) > > LieGrue, > strub > > > Am 01.07.2015 um 12:53 schrieb Rick Curtis <[email protected]>: > > > > 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* > > -- *Rick Curtis*
