Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:41:09+00:00 2026-06-05T18:41:09+00:00

I have defined a ConfigurationProperty class, which is basicly a key-value pair (with key

  • 0

I have defined a ConfigurationProperty class, which is basicly a key-value pair (with key being a strictly positive integer and value being a string):

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(detachable = "true")
public final class ConfigurationProperty
{
    @PrimaryKey
    @Persistent
    private Integer id;

    @Persistent
    private String value;

    public ConfigurationProperty(Integer id, String value)
    {
        this.id = id;
        this.setValue(value);
    }

    public Integer getId()
    {
        return this.id;
    }

    public String getValue()
    {
        return value;
    }

    public void setValue(String value)
    {
        this.value = value;
    }
}

As you can see, I’m defining a field “id” (which is the key of the key-value pair) and use it as the class’s primary key.

However, when I try to access an entry:

int searchId = 4;
ConfigurationProperty property =
        this.persistence.getObjectById(ConfigurationProperty.class, searchId);

I get the exception:

javax.jdo.JDOFatalUserException: Received a request to find an object of type [mypackage].ConfigurationProperty identified by 4.  This is not a valid representation of a primary key for an instance of [mypackage].ConfigurationProperty.

NestedThrowables:
org.datanucleus.exceptions.NucleusFatalUserException: Received a request to find an object of type [mypackage].ConfigurationProperty identified by 4.  This is not a valid representation of a primary key for an instance of [mypackage].ConfigurationProperty.)

I’m almost sure I would not run into an exception should I create a separate field for the primary key and the pair’s key, but that would create some form of redundancy and possibly performance issues, since the pair’s key is unique.

I also only get the exception on Google Appengine. When I tested the application using a Derby database, there were no problems.

Thank you for any suggestion!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:41:11+00:00Added an answer on June 5, 2026 at 6:41 pm

    Just change your primary key definition from:

    @PrimaryKey
    @Persistent
    private Integer id;
    

    To:

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    

    Will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined a 'vertex' class which, when combined, form a graph. these vertices
I have defined a class which represents a tree structure GeographicalUnits = Ext.extend(Ext.tree.TreePanel, {
I have defined a class in my main.css file. .red { color: #d14; }
I have defined this class: class Trade(Base): __tablename__ = 'TRADE' __table_args__ = {'quote':False} id
I have defined a class in JavaScript with a single method: function MyClass(text) {
I have defined a class XX like this: public class XX extends RelativeLayout {
I have defined a static resource: <UserControl x:Class=MyProject.MainPage xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:sys=clr-namespace:System;assembly=mscorlib mc:Ignorable=d
I have defined some sprites in a class .as file and I want to
I have defined new member in my class protected COMObject.Call call_ = null; This
I have defined an abstract method in my base class to take in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.