openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thirion <thirion.franc...@gmail.com>
Subject Re: Custom Mapping with Externalizer/Factory/Strategy
Date Mon, 21 May 2012 10:42:34 GMT
Hi Kevin, thanks for the reply.

“Being new to OpenJPA, you sure have a long, complicated note...  :-)”, lol,
I’m sorry.
Re:  openjpa-1979:  I’ll post a comment.

Re:  Strategy classpath issue:  By adding ‘false’ to the call to
getClassLoaderAction inside method:
protected FieldStrategy namedStrategy(FieldMapping field, boolean
installHandlers) 
of class:
org.apache.openjpa.jdbc.meta.MappingRepository
my class was able to be loaded:

Class<?> c = JavaTypes.classForName(name, field,
                AccessController.doPrivileged(
                   
J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)), false);

The boolean parameter for ‘mustExist’ should be false in order for issue
OpenJPA 758 to get taken into consideration and find the correct class
loader in JavaTypes.classForName method .

Re: OpenJPA source/tests/examples:
There are no examples/tests where Externalizer is used to represent an
entity, they’re always simple fields.  There is one example where Strategy
is used on a OneToOne mapping.  I followed the source into a maze of code
that I don’t understand.  

Re: Externalizer vs. Strategy:
With the following query:
select o from StrategyTestTest AS o where o.isn = 2

Externalizer:  the value for o.code is text, not an entity.
Strategy: the value for o.code is an entity :-) , but if I run:

select o.code from StrategyTestTest AS o where o.isn = 2

Then I get a list of description entities, instead of a single value.  So,
it makes sense that I then get an error when running:
select o.code.descr from StrategyTestTest AS o where o.isn = 2

Re: why?  I agree that this is a rediculous way to map data!  My problem is
that I’ve got a legacy (non relational) database with decades of sensitive
information running on a mainframe with more than 100 entities and some with
almost 200 fields with roughly 2000 concurrent users.  
When I asked if we could either change the data so that the data types are
always text (01 links to 01 and not 1) or refactor the descriptions table
into multiple tables for each description type the answer was: NO (except
not nearly as polite).

Does anybody have an example of how to map an entity relation using
@Strategy?
Sorry (again) for the long post.


--
View this message in context: http://openjpa.208410.n2.nabble.com/Custom-Mapping-with-Externalizer-Factory-Strategy-tp7563345p7568971.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message