openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2040) Problems when using "openjpa.MetaDataFactory" Property
Date Thu, 18 Aug 2011 17:30:27 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087131#comment-13087131
] 

Michael Dick commented on OPENJPA-2040:
---------------------------------------

The problem here lies in the MetaDataPlusMappingFactory. When the MetaData and Mapping factories
are the same class, we'll use a single instance and let it resolve all of the mappings. 

If the factories are not the same class the two factories are set to strictly do Mapping or
MetaData resolution respectively. This does not work if the user has extended the PersistenceMappingFactory
for example. Relaxing the requirement to strictly do Mapping or MetaData resolution allows
a user defined type to be used. 

The committed changes are a first pass at this problem, and allow the user to determine whether
the factories should strictly process Mapping info or MetaData. The behavior is configurable
by a compatibility setting : openjpa.Compatibility=metaFactoriesAreStrict=true|false. A follow
on fix would be to update the MetaDataPlusMappingFactory plugin to detect such an extension,
or to update our PersistenceMapping factory to better handle subclassing. 

Marcel, the changes will be available in the next nightly 2.2.0-SNAPSHOT (anything after revision
1159318 will work). Please give that build a try and let us know if it resolves the problem
for you. 

> Problems when using "openjpa.MetaDataFactory" Property
> ------------------------------------------------------
>
>                 Key: OPENJPA-2040
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2040
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>            Reporter: Marcel Urbanek
>            Assignee: Michael Dick
>              Labels: MetaDataFactory, PersistenceMetaDataFactory, openjpa.MetaDataFactory
>
> I want to overwrite the MetaDataFactory like described here: 
> http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_meta.html
> But it turned out it doesn't work. I managed to develop a test scenario 
> which easily produces the behaviour I encountered. 
> What _does_ work is the following: 
> Adding 
> <property name="openjpa.MetaDataFactory" value="jpa"/> 
> to persistence.xml. 
> When setting this property my junit test (persisting a simple association, 
> using @Column Annotation to use differing column names) does work. 
> According to the document above, this property Tag should be equivalent to 
> the setting above: 
> <property name="openjpa.MetaDataFactory" 
> value="org.apache.openjpa.persistence.PersistenceMetaDataFactory"/> 
> But when using this configuration my junit test fails. The differing 
> Column Names set by the @Column.name Attribute are no longer found. 
> Instead the Java Attribute-Names are used in the SQL. 
> My problem is, that I want to implement a custom MetaDataFactory and this 
> doesn't work either (which is expected, because I extend 
> PersistenceMetaDataFactory). 
> Using PersistenceMappingFactory instead doesn't work either.
> For detailed information please see the following discussion:
> http://openjpa.208410.n2.nabble.com/Problems-when-using-quot-openjpa-MetaDataFactory-quot-Property-td6671704.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message