You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Brian Kalbfus (JIRA)" <ji...@apache.org> on 2019/02/14 19:01:00 UTC

[jira] [Commented] (ISIS-2029) Using Application Identity (e.g. settings module) with .orm file leads to Webui exception

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

Brian Kalbfus commented on ISIS-2029:
-------------------------------------

This is the same error I came upon last year with application identity.  Where I thought the issue might have been resolved in 2.0.0-M1 and I was doing something wrong, I now believe it is still an issue. 

I created a github repository to demonstrate this error[1], from the SimpleApp archetype in version 2.0.0-M2.

 

 [1]https://github.com/bkalbfus/apache-isis-appidentity

> 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
>            Priority: Major
>             Fix For: 1.19.0
>
>         Attachments: stacktrace.txt
>
>
> 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)