openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <dwo...@apache.org>
Subject Re: svn commit: r915593 - in /openjpa/trunk/openjpa-persistence-jdbc/src: main/java/org/apache/openjpa/persistence/jdbc/ test/java/org/apache/openjpa/persistence/embed/attrOverrides/ test/resources/org/apache/openjpa/persistence/embed/
Date Wed, 24 Feb 2010 13:10:29 GMT
Fixed by Fay in r915654


On 2/23/10 8:06 PM, Donald Woods wrote:
> Looks like this is causing one new failure on Derby 10.5.3 w/ Sun JDK 6-
> 
> TestAssocOverridesXML.testElementCollectionAssocOverrides  View test
> details   (org.apache.openjpa.persistence.embed.attrOverrides)
>     junit.framework.AssertionFailedError: None of the following 27 SQL
>     CREATE TABLE XMLAssocOverEntityA (id INTEGER NOT NULL, PRIMARY KEY (id))
>     CREATE TABLE XMLAssocOverEntityB (id INTEGER NOT NULL, name
> VARCHAR(255), PRIMARY KEY (id))
>     Please wait... Show stacktrace »
>     « Hide stacktrace
>     junit.framework.AssertionFailedError: None of the following 27 SQL
>     CREATE TABLE XMLAssocOverEntityA (id INTEGER NOT NULL, PRIMARY KEY (id))
>     CREATE TABLE XMLAssocOverEntityB (id INTEGER NOT NULL, name
> VARCHAR(255), PRIMARY KEY (id))
>     CREATE TABLE XMLAssocOverEntityB_XMLAssocOverEntityA
> (XMLASSOCOVERENTITYB_ID INTEGER, EALIST_ID INTEGER)
>     CREATE TABLE XML_EMBALIST (XMLASSOCOVERENTITYA_ID INTEGER, name
> VARCHAR(255), emba_entb INTEGER, emba_mentb INTEGER)
>     CREATE TABLE XML_EMBAMAP_3 (XMLASSOCOVERENTITYA_ID INTEGER, name
> VARCHAR(255), key_emba_entb INTEGER, key_emba_mentb INTEGER,
> value_emba_entb INTEGER, value_emba_mentb INTEGER)
>     CREATE INDEX I_XMLSTTY_ELEMENT ON
> XMLAssocOverEntityB_XMLAssocOverEntityA (EALIST_ID)
>     CREATE INDEX I_XMLSTTY_XMLASSOCOVERENTITYB_ID ON
> XMLAssocOverEntityB_XMLAssocOverEntityA (XMLASSOCOVERENTITYB_ID)
>     CREATE INDEX I_XML_LST_EB ON XML_EMBALIST (emba_entb)
>     CREATE INDEX I_XML_LST_MEB ON XML_EMBALIST (emba_mentb)
>     CREATE INDEX I_XML_LST_XMLASSOCOVERENTITYA_ID ON XML_EMBALIST
> (XMLASSOCOVERENTITYA_ID)
>     CREATE INDEX I_XML_P_3_EB ON XML_EMBAMAP_3 (key_emba_entb)
>     CREATE INDEX I_XML_P_3_EB1 ON XML_EMBAMAP_3 (value_emba_entb)
>     CREATE INDEX I_XML_P_3_MEB ON XML_EMBAMAP_3 (key_emba_mentb)
>     CREATE INDEX I_XML_P_3_MEB1 ON XML_EMBAMAP_3 (value_emba_mentb)
>     CREATE INDEX I_XML_P_3_XMLASSOCOVERENTITYA_ID ON XML_EMBAMAP_3
> (XMLASSOCOVERENTITYA_ID)
>     SELECT SEQUENCE_VALUE FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ? FOR
> UPDATE WITH RR
>     UPDATE OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ?
> AND SEQUENCE_VALUE = ?
>     SELECT t0.name FROM XMLAssocOverEntityB t0 WHERE t0.id = ?
>     SELECT SEQUENCE_VALUE FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ? FOR
> UPDATE WITH RR
>     UPDATE OPENJPA_SEQUENCE_TABLE SET SEQUENCE_VALUE = ? WHERE ID = ?
> AND SEQUENCE_VALUE = ?
>     SELECT t0.name FROM XMLAssocOverEntityB t0 WHERE t0.id = ?
>     INSERT INTO XMLAssocOverEntityA (id) VALUES (?)
>     INSERT INTO XMLAssocOverEntityB (id, name) VALUES (?, ?)
>     INSERT INTO XMLAssocOverEntityB (id, name) VALUES (?, ?)
>     INSERT INTO XML_EMBALIST (XMLASSOCOVERENTITYA_ID, name, emba_entb,
> emba_mentb) VALUES (?, ?, ?, ?)
>     INSERT INTO XMLAssocOverEntityB_XMLAssocOverEntityA
> (XMLASSOCOVERENTITYB_ID, EALIST_ID) VALUES (?, ?)
>     INSERT INTO XMLAssocOverEntityB_XMLAssocOverEntityA
> (XMLASSOCOVERENTITYB_ID, EALIST_ID) VALUES (?, ?)
> 
>     contains all keys
>     CREATE TABLE XML_EMBAMAP_1 .* .*key_emba_entb.*key_emba_mentb
> .*value_emba_entb.*value_emba_mentb
> 
>     at junit.framework.Assert.fail(Assert.java:47)
>     at
> org.apache.openjpa.persistence.embed.attrOverrides.TestAssocOverridesXML.assertSQLFragnments(TestAssocOverridesXML.java:102)
>     at
> org.apache.openjpa.persistence.embed.attrOverrides.TestAssocOverridesXML.testElementCollectionAssocOverrides(TestAssocOverridesXML.java:85)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at junit.framework.TestCase.runTest(TestCase.java:154)
>     at
> org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:514)
>     at junit.framework.TestCase.runBare(TestCase.java:127)
>     at
> org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:501)
>     at
> org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:477)
>     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     at junit.framework.TestResult.runProtected(TestResult.java:124)
>     at junit.framework.TestResult.run(TestResult.java:109)
>     at junit.framework.TestCase.run(TestCase.java:118)
>     at
> org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:177)
>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
>     at junit.framework.TestSuite.run(TestSuite.java:203)
>     at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
>     at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>     at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>     at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>     at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> 
> 
> On 2/23/10 6:46 PM, faywang@apache.org wrote:
>> Author: faywang
>> Date: Tue Feb 23 23:46:26 2010
>> New Revision: 915593
>>
>> URL: http://svn.apache.org/viewvc?rev=915593&view=rev
>> Log:
>> OPENJPA-1527: fix AssociationOverride on the key of map where the key is an embeddable
via orm.xml. 
>>
>> Added:
>>     openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java
  (with props)
>> Modified:
>>     openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
>>     openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java
>>     openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEntityA.java
>>     openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml
>>     openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml
>>
>> Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java?rev=915593&r1=915592&r2=915593&view=diff
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
(original)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
Tue Feb 23 23:46:26 2010
>> @@ -26,6 +26,8 @@
>>  import java.util.HashMap;
>>  import java.util.List;
>>  import java.util.Map;
>> +import java.util.Set;
>> +
>>  import javax.persistence.DiscriminatorType;
>>  import javax.persistence.EnumType;
>>  import javax.persistence.InheritanceType;
>> @@ -56,11 +58,13 @@
>>  import org.apache.openjpa.lib.log.Log;
>>  import org.apache.openjpa.lib.meta.SourceTracker;
>>  import org.apache.openjpa.lib.util.Localizer;
>> +import org.apache.openjpa.meta.AccessCode;
>>  import org.apache.openjpa.meta.ClassMetaData;
>>  import org.apache.openjpa.meta.FieldMetaData;
>>  import org.apache.openjpa.meta.JavaTypes;
>>  import org.apache.openjpa.persistence.XMLPersistenceMetaDataParser;
>>  import org.apache.openjpa.util.InternalException;
>> +import org.apache.openjpa.util.MetaDataException;
>>  import org.apache.openjpa.util.UserException;
>>  import org.xml.sax.Attributes;
>>  import org.xml.sax.Locator;
>> @@ -1390,6 +1394,27 @@
>>          }
>>          return null;
>>      }
>> +
>> +    /**
>> +     * Process all deferred embeddables using an unknown access type.
>> +     */
>> +    protected void addDeferredEmbeddableMetaData() {
>> +        super.addDeferredEmbeddableMetaData();
>> +        if (_deferredMappings.size() > 0) {
>> +            Set<Class<?>> keys = _deferredMappings.keySet();
>> +            Class[] classes = keys.toArray(new Class[0]);
>> +            for (int i = 0; i < classes.length; i++) {
>> +                try {
>> +                    applyDeferredEmbeddableOverrides(classes[i]);
>> +                } catch (Exception e) {
>> +                    throw new MetaDataException(
>> +                            _loc.get("no-embeddable-metadata",
>> +                                classes[i].getName()), e);
>> +                }
>> +            }
>> +        }
>> +        
>> +    }    
>>      
>>      // Inner class for storing override information
>>      class DeferredEmbeddableOverrides {
>>
>> Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java?rev=915593&r1=915592&r2=915593&view=diff
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java
(original)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/TestAssocOverridesXML.java
Tue Feb 23 23:46:26 2010
>> @@ -82,6 +82,9 @@
>>              assertSQLFragnments(_sql, "CREATE TABLE XML_EMBALIST .*" +
>>                  " .*emba_entb.*emba_mentb");
>>          
>> +            assertSQLFragnments(_sql, "CREATE TABLE XML_EMBAMAP_1 .*" +
>> +                " .*key_emba_entb.*key_emba_mentb" + 
>> +                " .*value_emba_entb.*value_emba_mentb");
>>          } 
>>          finally {
>>              try {
>>
>> Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java?rev=915593&view=auto
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java
(added)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java
Tue Feb 23 23:46:26 2010
>> @@ -0,0 +1,52 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.openjpa.persistence.embed.attrOverrides;
>> +
>> +public class XMLAssocOverEmbedB {
>> +    
>> +    private String name;
>> +    
>> +    private XMLAssocOverEntityB eb;
>> +
>> +    private XMLAssocOverEntityB meb;
>> +    
>> +    public void setName(String name) {
>> +        this.name = name;
>> +    }
>> +
>> +    public String getName() {
>> +        return name;
>> +    }
>> +
>> +    public void setEb(XMLAssocOverEntityB eb) {
>> +        this.eb = eb;
>> +    }
>> +
>> +    public XMLAssocOverEntityB getEb() {
>> +        return eb;
>> +    }
>> +
>> +    public void setMeb(XMLAssocOverEntityB meb) {
>> +        this.meb = meb;
>> +    }
>> +
>> +    public XMLAssocOverEntityB getMeb() {
>> +        return meb;
>> +    }
>> +}
>>
>> Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEmbedB.java
>> ------------------------------------------------------------------------------
>>     svn:eol-style = native
>>
>> Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEntityA.java
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEntityA.java?rev=915593&r1=915592&r2=915593&view=diff
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEntityA.java
(original)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/attrOverrides/XMLAssocOverEntityA.java
Tue Feb 23 23:46:26 2010
>> @@ -19,12 +19,16 @@
>>  package org.apache.openjpa.persistence.embed.attrOverrides;
>>  
>>  import java.util.List;
>> +import java.util.Map;
>>  
>>  public class XMLAssocOverEntityA {
>>  
>>      private int id;
>>      
>>      private List<XMLAssocOverEmbed> embaList;
>> +    
>> +    private Map<XMLAssocOverEmbedB, XMLAssocOverEmbed> embaMap;
>> +    
>>  
>>      public void setEmbA(List<XMLAssocOverEmbed> embA) {
>>          this.embaList = embA;
>> @@ -34,6 +38,14 @@
>>          return embaList;
>>      }
>>  
>> +    public void setEmbAMap(Map<XMLAssocOverEmbedB, XMLAssocOverEmbed> embAMap)
{
>> +        this.embaMap = embAMap;
>> +    }
>> +
>> +    public Map<XMLAssocOverEmbedB, XMLAssocOverEmbed> getEmbAMap() {
>> +        return embaMap;
>> +    }
>> +
>>      public void setId(int id) {
>>          this.id = id;
>>      }
>>
>> Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml?rev=915593&r1=915592&r2=915593&view=diff
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml
(original)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml
Tue Feb 23 23:46:26 2010
>> @@ -37,6 +37,21 @@
>>                  </association-override>
>>                  <collection-table name="XML_EMBALIST"/>
>>              </element-collection>
>> +            <element-collection name="embaMap">
>> +                <association-override name="key.eb">
>> +                    <join-column name="key_emba_entb" />
>> +                </association-override>
>> +                <association-override name="key.meb">
>> +                    <join-column name="key_emba_mentb" />
>> +                </association-override>
>> +                <association-override name="value.eb">
>> +                    <join-column name="value_emba_entb" />
>> +                </association-override>
>> +                <association-override name="value.meb">
>> +                    <join-column name="value_emba_mentb" />
>> +                </association-override>
>> +                <collection-table name="XML_EMBAMAP_3"/>
>> +            </element-collection>
>>          </attributes>
>>      </entity>
>>      
>> @@ -69,4 +84,21 @@
>>              </one-to-one>
>>          </attributes>
>>      </embeddable>    
>> +    
>> +    <embeddable class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbedB">
>> +        <attributes>
>> +            <basic name="name"/>
>> +            <many-to-one name="meb">
>> +                <cascade>
>> +                    <cascade-all />
>> +                </cascade>
>> +            </many-to-one>
>> +            <one-to-one name="eb">
>> +                <cascade>
>> +                    <cascade-all />
>> +                </cascade>
>> +            </one-to-one>
>> +        </attributes>
>> +    </embeddable>    
>> +    
>>  </entity-mappings>
>> \ No newline at end of file
>>
>> Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml
>> URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml?rev=915593&r1=915592&r2=915593&view=diff
>> ==============================================================================
>> --- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml
(original)
>> +++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/embed/embed-persistence.xml
Tue Feb 23 23:46:26 2010
>> @@ -23,6 +23,7 @@
>>      <persistence-unit name="AssocOverPU">
>>          <mapping-file>org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml</mapping-file>
>>          <class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed</class>
>> +        <class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbedB</class>
>>          <class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA</class>
>>          <class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB</class>
>>              <properties>
>>
>>
>>
> 

Mime
View raw message