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

  • Home
  • SEARCH
  • 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 1115333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:08:27+00:00 2026-05-17T03:08:27+00:00

I have a simple class, relevant details below: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class SimpleCategory

  • 0

I have a simple class, relevant details below:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class SimpleCategory implements Serializable{
... 
 public static enum type{
  Course,
  Category,
  Cuisine
 }

 @Persistent
 public type t;
...
}

I am attempting to query all SimpleCategory objects of the same type.

public SimpleCategory[] getCategories(SimpleCategory.type type) {
 PersistenceManager pm = PMF.get().getPersistenceManager();

 try{
  Query q = pm.newQuery(SimpleCategory.class);
  q.setFilter("t == categoryType");
  q.declareParameters("SimpleCategory.type categoryType");
  List<SimpleCategory> cats = (List<SimpleCategory>) q.execute(type);
...
}

This results in a ClassNotResolvedException for SimpleCategory.type. The google hits I’ve found so far recommended to:

  • Use query.declareImports to specify the class i.e. q.declareImports(“com.test.zach.SimpleCategory.type”);
  • Specify the fully qualified name of SimpleCategory in declareParameters

Neither of these suggestions has worked. By removing .type and recompiling, I can verify that declareParameters can see SimpleCategory just fine, it simply cannot see the SimpleCategory.type, despite the fact that the remainder of the method has full visibility to it.

What am I missing?

  • 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-05-17T03:08:28+00:00Added an answer on May 17, 2026 at 3:08 am

    Something that has seemed to work for me is writing the query string using an implicit parameter and not using the declareParameters() method.

    q.setFilter("t == :categoryType");
    List<SimpleCategory> cats = (List<SimpleCategory>) q.execute(type)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class Student under namespace School. namespace XmlTestApp { public class
I have a simple class I'm serializing. [DataContract(Name = Test, Namespace = )] public
I have a simple class inheriting from WebControl as follow: public class Instrument :
I have an simple class that I get from a webservice. public class person
I have simple class with width and height member fields which define number of
I have a simple class for use on JNI, which i need to export
I have a simple Class Hierarchy that I am trying to get to work
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have a simple class that contains some general information about the current web
I have a simple class library (COM+ service) written in C# to consume 5

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.