openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath Thomann (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-1957) XML overriding column names for ArrayList attributes causes exception.
Date Fri, 20 Jan 2012 20:04:44 GMT

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

Heath Thomann commented on OPENJPA-1957:
----------------------------------------

Hi!  I have a test (to be included) where I see the same exception which was fixed via this
JIRA:

<openjpa-1.2.3-SNAPSHOT-r422266:1176024 fatal user error> org.apache.openjpa.persistence.ArgumentException:
You have supplied columns for "org.apache.openjpa.persistence.arrays.model.XMLOneToManyEntity.xmlManyToOneList",
but this mapping cannot have columns in this context.
	at org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:327)
	at org.apache.openjpa.jdbc.meta.strats.RelationToManyTableFieldStrategy.map(RelationToManyTableFieldStrategy.java:96)
	at org.apache.openjpa.jdbc.meta.strats.RelationCollectionTableFieldStrategy.map(RelationCollectionTableFieldStrategy.java:94)
	at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:121)
	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:454)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:419)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:855)
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1651)
	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:812)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:772)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:650)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:393)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataLocking(MetaDataRepository.java:366)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:360)
	at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:356)
	at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
	at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:153)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:189)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
	at org.apache.openjpa.persistence.arrays.TestXMLOneToManyEntity.testExceptionArrayAsLob(TestXMLOneToManyEntity.java:34)
	.......................

I see the same exception when I run my test on trunk.  The kicker is, if I back out the changes
made in this JIRA, on both 1.2.x and trunk, my test passes!!  :-(  Of course, with the code
changes backed out, the test Mike created for the JIRA fails.  So something is not quite right/complete
about this fix.  

Attached is a test, named  "XMLMappingIssue-trunk.test" which you can simply apply to any
OpenJPA release.  I'd assume that if we fix this issue on trunk the same fix would apply to
1.2.x........although, the fix Mike made to 1.2.x is for some reason a bit different than
the one he made to trunk so we may want to keep this in mind and become familiar with the
differences.

Does anyone have any thoughts here?

Thanks,

Heath
                
> XML overriding column names for ArrayList attributes causes exception.
> ----------------------------------------------------------------------
>
>                 Key: OPENJPA-1957
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1957
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.2, 2.0.1, 2.1.0
>            Reporter: Heath Thomann
>            Assignee: Michael Dick
>            Priority: Minor
>             Fix For: 1.2.3, 2.0.2, 2.1.1, 2.2.0
>
>
> Take an entity class similar to the following:
> public class MyEntity implements Serializable {
>    protected String _id;
>    protected ArrayList<String> myStrings = new ArrayList<String>();
> .......
> and a corresponding XML mapping in orm.xml:
>   	<entity class="somepackage.MyEntity" access="FIELD">
> 		<table name="MY_TABLE"/>
> 		<attributes>
> 			<id name="_id">
> 				<column name="MYENTITY_ID" nullable="false" />
> 			</id>
>           <basic name="myStrings">
>             <column name="MY_STRINGS"/>
>             <lob/>
>          </basic>
> 		</attributes>
> 	</entity>
> With this configuration, the following exception can occur:
> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "somepackage.MyEntity.myStrings<element:class
java.lang.String>", but this mapping cannot have columns in this context.
> 	at org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:327)
> 	at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:77)
> 	at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:121)
> 	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
> 	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:454)
> 	at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:419)
> 	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:881)
> 	at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:418)
> ..............

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message