I am using ISIS 1.3.0 with JDO 3.0.1, Data Nucleus 3.2.4

Using JDO Application Identity strategy, I have a composite PK class with two 
attributes(PK fields of type String).

As per the JDO specifications, PK class has overridden the following methods:
hascode, equals and toString.

And it has Constructor which takes String parameter.

Problem is that for some Entities OID is not found if any of the PK fields has 
the same character which is used to join in the toString method
For example: Consider the below PK class:
public class OmGeoLocationPK implements java.io.Serializable {

      public String locationId;
      public String orgId;
public OmGeoLocationPK() {
      }

      public OmGeoLocationPK(String locationId, String orgId) {
            this.locationId = locationId;
            this.orgId = orgId;
      }
      public OmGeoLocationPK(String key){
            StringTokenizer token = new StringTokenizer(key, "_");
            this.locationId = token.nextToken();
            this.orgId = token.nextToken();

      }

      public String getLocationId() {
            return this.locationId;
      }

      public void setLocationId(String locationId) {
            this.locationId = locationId;
      }

      public String getOrgId() {
            return this.orgId;
      }

      public void setOrgId(String orgId) {
            this.orgId = orgId;
      }

      public String toString() {
            return "" + locationId + "_" + this.orgId;
      }

      @Override
      public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result
                        + ((locationId == null) ? 0 : locationId.hashCode());
            result = prime * result + ((orgId == null) ? 0 : orgId.hashCode());
            return result;
      }

      @Override
      public boolean equals(Object obj) {
            if (this == obj)
                  return true;
            if (obj == null)
                  return false;
            if (getClass() != obj.getClass())
                  return false;
            OmGeoLocationPK other = (OmGeoLocationPK) obj;
            if (locationId == null) {
                  if (other.locationId != null)
                        return false;
            } else if (!locationId.equals(other.locationId))
                  return false;
            if (orgId == null) {
                  if (other.orgId != null)
                        return false;
            } else if (!orgId.equals(other.orgId))
                  return false;
            return true;
      }



}

Here in the toString method "_" character used to join two PK fields 
(locationId and orgId).

So, if locationId or orgId has the chracter "_" in its S
tring value, Splitting with StringTokenizer is not evaluating the correct PK 
feilds values and it throws the following exception:


Caused by: org.apache.isis.core.runtime.persistence.ObjectNotFoundException: 
Object not found in store with oid 
OmSite:com.wipro.wess.OmGeoLocationPK_ORG_FILTER_TEST_ATL
      at 
org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:308)
      at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type$2.recreateAdapter(ObjectAdapterMemento.java:112)
      at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type.getAdapter(ObjectAdapterMemento.java:183)
      at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.getObjectAdapter(ObjectAdapterMemento.java:301)
      at 
org.apache.isis.viewer.wicket.ui.components.widgets.entitylink.EntityLinkSelect2Panel.onSelected(EntityLinkSelect2Panel.java:328)
      at 
org.apache.isis.viewer.wicket.ui.components.widgets.entitylink.EntityLinkSelect2Panel.convertInput(EntityLinkSelect2Panel.java:156)
      at 
org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1137)
      at org.apache.wicket.markup.html.form.Form$16.validate(Form.java:1862)
      at 
org.apache.wicket.markup.html.form.Form$ValidationVisitor.component(Form.java:177)
      at 
org.apache.wicket.markup.html.form.Form$ValidationVisitor.component(Form.java:161)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:274)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at 
org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:262)
      at org.apache.wicket.util.visit.Visits.visitPostOrder(Visits.java:245)
      at 
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:389)
      at 
org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:1093)
      at 
org.apache.wicket.markup.html.form.Form.validateComponents(Form.java:1854)
      at org.apache.wicket.markup.html.form.Form.validate(Form.java:1819)
      at org.apache.wicket.markup.html.form.Form.process(Form.java:894)
      at 
org.apache.isis.viewer.wicket.ui.panels.FormAbstract.process(FormAbstract.java:118)
      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)
      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
      ... 41 more
Caused by: javax.jdo.JDOObjectNotFoundException: No such database row
FailedObject:ORG_FILTER
NestedThrowables:
org.datanucleus.exceptions.NucleusObjectNotFoundException: No such database row
      at 
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:475)
      at 
org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1727)
      at 
org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)
      at 
org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadPojo(DataNucleusObjectStore.java:404)
      at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.adaptermanager.DataNucleusPojoRecreator.recreatePojo(DataNucleusPojoRecreator.java:38)
      at 
org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:305)
      ... 68 more

Actually, locationId is: ORG_FILTER_TEST and orgId is : ATL.
But after tokenizing with "_" OID evaluated as
ORG_FILTER as locationId has "_" in it.

So I tried with other characters which would not be expected in those fields 
like ":" (colon), "::"(double colon). But these characters are not supported. 
And I got the exception coming from OIDMarshaller of ISIS



       at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:171)
       ... 41 more
Caused by: java.lang.IllegalArgumentException: Could not parse OID 
'OmGeoLocation:com.wipro.wess.OmGeoLocationPK_EC3::WPL'; should match pattern: 
^((([!*])?([^:~$\^#]+):([^:~$\^#]+))((~[^:~$\^#]+:[^:~$\^#]+)*))([$][^:~$\^#]+)?([\^](\d+):([^:~$\^#]+)?:(\d+)?)?$
       at 
org.apache.isis.core.metamodel.adapter.oid.OidMarshaller.unmarshal(OidMarshaller.java:146)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type$2.recreateAdapter(ObjectAdapterMemento.java:110)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type.getAdapter(ObjectAdapterMemento.java:183)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.getObjectAdapter(ObjectAdapterMemento.java:301)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.captureTitleHintIfPossible(ObjectAdapterMemento.java:279)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.<init>(ObjectAdapterMemento.java:239)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.createOrNull(ObjectAdapterMemento.java:58)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Functions$6.apply(ObjectAdapterMemento.java:416)
       at 
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Functions$6.apply(ObjectAdapterMemento.java:412)
       at com.google.common.collect.Iterators$8.transform(Iterators.java:794)
       at 
com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
       at com.google.common.collect.Iterators.addAll(Iterators.java:357)
       at com.google.common.collect.Lists.newArrayList(Lists.java:146)
       at com.google.common.collect.Lists.newArrayList(Lists.java:128)
       at 
org.apache.isis.viewer.wicket.model.models.EntityCollectionModel.asMementoList(EntityCollectionModel.java:156)
       at 
org.apache.isis.viewer.wicket.model.models.EntityCollectionModel.createStandalone(EntityCollectionModel.java:145)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel$ResultType$2.addOrReplaceCollectionResultsPanel(ActionPanel.java:392)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel$ResultType$2.addResults(ActionPanel.java:388)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:213)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:165)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:102)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.<init>(ActionPanel.java:95)
       at 
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
       at 
org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:82)
       at 
org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:120)
       at 
org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:105)
       at 
org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:281)
       at 
org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addChildComponents(PageAbstract.java:276)
       at 
org.apache.isis.viewer.wicket.ui.pages.action.ActionPage.<init>(ActionPage.java:54)
       ... 46 more
Please help on this issue.

BR
Ranganath Varma


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to