You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Ranganath Chittari (JIRA)" <ji...@apache.org> on 2013/12/20 10:48:09 UTC

[jira] [Created] (JDO-726) Application Identity: org.datanucleus.exceptions.NucleusException: The key value passed to construct a SingleFieldIdentity of type "javax.jdo.identity.StringIdentity" for class should be String

Ranganath Chittari created JDO-726:
--------------------------------------

             Summary: Application Identity: org.datanucleus.exceptions.NucleusException: The key value passed to construct a SingleFieldIdentity of type "javax.jdo.identity.StringIdentity" for class should be String
                 Key: JDO-726
                 URL: https://issues.apache.org/jira/browse/JDO-726
             Project: JDO
          Issue Type: Bug
            Reporter: Ranganath Chittari
            Priority: Blocker


Hello I am trying with application identity for my Entity.
I have String column in my class which acts as primary key. It has annotation:
@Persistent(primaryKey = "true")
When I try to persist this entity, it throws the following exception:
org.datanucleus.exceptions.NucleusException: The key value passed to construct a SingleFieldIdentity of type "javax.jdo.identity.StringIdentity" for class "com.wipro.wess.MOrganisation" is of an incorrect type ("javax.jdo.identity.StringIdentity") - should be "String".
	at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:591)
	at org.datanucleus.api.jdo.JDOPersistenceManager.newObjectIdInstance(JDOPersistenceManager.java:1622)
	at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)

I tried to resolve it by extending javax.jdo.identity.StringIdentity class by overriding the method as below:
	public synchronized Object getKeyAsObject() {
		return (Object)this.orgId;
	}
But the same issue still persists. Please help me out on this issue

Thanks 
Ranganath



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)