openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject ValueHandlers vs FieldStrategies
Date Mon, 24 Nov 2008 19:47:20 GMT
Hi,
A question has surfaced about the use of ValueHandlers vs FieldStrategies.
According to the OpenJPA documentation [1], a user should be able to specify
either a custom ValueHandler implementation or FieldStrategy implementation
via the @Strategy annotation.  This does not seem to be the case.  Our
OpenJPA implementation is quite dependent on a ValueHandler implementation
for the value of the @Strategy annotation.  After instantiating the Class
that is specified in the annotation, OpenJPA explicitly attempts to assign
it as a ValueHandler.  If it can't pass this test, then we return null and
process as if nothing was specified.  No warning message or anything.

FYI, the FieldStrategy can be specified in the persistence.xml as a
MappingDefault (also documented in [1]).  This approach works, but then
we're specifying the FieldStrategy for all instances of that type -- not
specific attribute instances.

Although we are losing a few of the original development team members, I'm
wondering if anybody has any history with these ValueHandlers and/or
FieldStrategies?

o  Are ValueHandlers meant for individual field processing, and the
FieldStrategies meant for more global type processing?  This definition fits
well with the current implementation, but I'm not ready to declare that as
gospel.

o  A warning message of some type would be good for the case where the
Strategy can't be properly instantiated and used.

o  I also re-discovered the problem that was recently identified via JIRA
OPENJPA-758 [2].

o  The documentation needs to be clarified, at a minimum.  No matter what we
come up with for a final solution, this section needs a bit of work.

Comments and suggestions are welcome, especially from our past experts from
BEA and SolarMetric...  :-)

Thanks,
Kevin


[1]
http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/manual.html#ref_guide_mapping_custom_field
[2] https://issues.apache.org/jira/browse/OPENJPA-758

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message