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 "Andy Jefferson (JIRA)" <ji...@apache.org> on 2013/12/20 11:56:09 UTC

[jira] [Commented] (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

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

Andy Jefferson commented on JDO-726:
------------------------------------

Apache JDO JIRA is no place to ask _questions_ about *usage* of the JDO API. You do that on _forums_ for the implementation that you're using, and when you do that you post full details of what you were doing (an exception thrown from getObjectById() is nothing to do with your "try to persist this entity").

> 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)