OpenJPA
  1. OpenJPA
  2. OPENJPA-1957

XML overriding column names for ArrayList attributes causes exception.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.2, 2.0.1, 2.1.0
    • Fix Version/s: 1.2.3, 2.0.2, 2.1.1, 2.2.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      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)
      ..............

        Issue Links

          Activity

          Albert Lee made changes -
          Link This issue breaks OPENJPA-2117 [ OPENJPA-2117 ]
          Michael Dick made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Michael Dick made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Michael Dick made changes -
          Assignee Heath Thomann [ jpaheath ] Michael Dick [ mikedd ]
          Michael Dick made changes -
          Field Original Value New Value
          Fix Version/s 1.2.3 [ 12314517 ]
          Fix Version/s 2.0.2 [ 12315257 ]
          Fix Version/s 2.1.1 [ 12316191 ]
          Fix Version/s 2.2.0 [ 12315910 ]
          Heath Thomann created issue -

            People

            • Assignee:
              Michael Dick
              Reporter:
              Heath Thomann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development