Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-2029

Using Application Identity (e.g. settings module) with .orm file leads to Webui exception

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.16.2
    • Fix Version/s: 2.1.2
    • Component/s: Core, Core: Viewer: Wicket
    • Labels:
      None

      Description

      Problem description

      I want to use settings module (incode or previous isis-addons) so that the tables are persisted in custom database schema (different than isissettings).

      In order to achieve this I have created a custom .orm file e.g.

       

      package-custom.orm 

      <?xml version="1.0" encoding="UTF-8" ?>
      <orm xmlns="http://xmlns.jcp.org/xml/ns/jdo/orm"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/orm http://xmlns.jcp.org/xml/ns/jdo/orm_3_0.xsd">
      
      <package name="org.isisaddons.module.settings.dom.jdo">
          <class name="ApplicationSettingJdo" schema="myschema" table="IsisAppSetting"/>
          <class name="UserSettingJdo" schema="myschema" table="IsisUserSetting"/>
      </package>
      
      </orm>
      

      and refer the file in persistor_datanucleus.properties

      # schema name override
      isis.persistor.datanucleus.impl.datanucleus.Mapping=custom

       

      I can create single ApplicationSetting thru WebUI but if I have more than one persisted, here the WebUI exception I get in WebUI

      Caused by:
      org.datanucleus.exceptions.NucleusUserException
      Identity "interface.MQTT.activated[OID]org.incode.example.settings.dom.jdo.ApplicationSettingJdo" is assigned to class "org.incode.example.settings.dom.jdo.ApplicationSettingJdo", but its not the correct object-id type for this class.
      org.datanucleus.store.AbstractStoreManager#manageClassForIdentity(AbstractStoreManager.java:937)
      org.datanucleus.ExecutionContextImpl#getClassDetailsForId(ExecutionContextImpl.java:3385)
      org.datanucleus.ExecutionContextImpl#findObjects(ExecutionContextImpl.java:3251)

       

      I believe the root cause is that Datanucleus thinks somehow that the ApplicationSetting has not Application Identity which it has since field key is primary key - but only in the case when retreiving more then one entity from database.

       

      All works fine when creating new instance ApplicationSetting or reading it from database by key. The command "Settings --> listAll" fails.

       

      I tried also to adapt the .orm file e.g. but it didn't helped.

      <package name="org.incode.example.settings.dom.jdo">
          <class name="ApplicationSettingJdo" identity-type="application" schema="myschema" table="IsisAppSetting">
              <field name="key" primary-key="true"/>
          </class&gt;
          <class name="UserSettingJdo" identityType="application" schema="myschema" table="IsisUserSetting"/>
      </package>

        Attachments

        1. stacktrace.txt
          15 kB
          Vladimir Nisevic

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              niv Vladimir Nisevic
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: