Vladimir Nisevic created ISIS-2029:
--------------------------------------
Summary: Using Application Identity (e.g. settings module) with
.orm file leads to Webui exception
Key: ISIS-2029
URL: https://issues.apache.org/jira/browse/ISIS-2029
Project: Isis
Issue Type: Bug
Components: Core, Core: Viewer: Wicket
Affects Versions: 1.16.2
Reporter: Vladimir Nisevic
h2.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
{code:java}
<?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>
{code}
and refer the file in persistor_datanucleus.properties
{code:java}
# schema name override
isis.persistor.datanucleus.impl.datanucleus.Mapping=custom{code}
I can create single ApplicationSetting thru WebUI but if I have more than one
persisted, here the WebUI exception I get in WebUI
{code:java}
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){code}
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.
{code:java}
<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>
<class name="UserSettingJdo" identityType="application" schema="myschema"
table="IsisUserSetting"/>
</package>{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)