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 1069543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:26:06+00:00 2026-05-16T20:26:06+00:00

I have an interface @PersistenceCapable public interface MyInterface { public abstract String getName(); public

  • 0

I have an interface

@PersistenceCapable
public interface MyInterface {

    public abstract String getName();

    public abstract void setName(String name);

}

The persistence layer uses JDO. The JDO implementation is DataNucleus. Now I want to query for any instances of that interface with JDOQL.

Query query = getPersistenceManager().newQuery(MyInterface.class);

That works fine. Now I want to filter the query results by name. Of course the interface has no attributes. The attributes of its implementation may differ. Any instance of MyInterface returns its name by the getName() method.

How do I use this method with JDOQL?

I tried a bit:

  1. query.setFilter("name == \"" + name);
  2. query.setFilter("name() == \"" + name);
  3. query.declareVariables("myPackage.MyInterface myInterface");
    query.setFilter("myInterface.name == \"" + name);
  4. query.declareVariables("myPackage.MyInterface myInterface");
    query.setFilter("myInterface.name() == \"" + name);

JDO still keeps throwing exceptions (look at the bottom). I am not shure if this is applicable to interfaces, but there is a get and a set accesor method, which is a property in java beans terms. I added the @Persistent annotation to the getName() method of the interface and its implementation, but nothing changed.

How do I filter a query for interface instances?

Thanks in advance.

Here is the exception JDO throws:

org.datanucleus.jdo.NucleusJDOHelper getJDOExceptionForNucleusException
INFO: Exception thrown
Invalid string literal (End of stream): identity.name == "Identity 0
org.datanucleus.exceptions.NucleusUserException: Invalid string literal (End of stream): identity.name == "Identity 0
    at org.datanucleus.query.compiler.Lexer.parseStringLiteral(Lexer.java:689)
    at org.datanucleus.query.compiler.JDOQLParser.processLiteral(JDOQLParser.java:1012)
    at org.datanucleus.query.compiler.JDOQLParser.processPrimary(JDOQLParser.java:678)
    at org.datanucleus.query.compiler.JDOQLParser.processUnaryExpression(JDOQLParser.java:621)
    at org.datanucleus.query.compiler.JDOQLParser.processMultiplicativeExpression(JDOQLParser.java:547)
    at org.datanucleus.query.compiler.JDOQLParser.processAdditiveExpression(JDOQLParser.java:518)
    at org.datanucleus.query.compiler.JDOQLParser.processRelationalExpression(JDOQLParser.java:450)
    at org.datanucleus.query.compiler.JDOQLParser.processAndExpression(JDOQLParser.java:427)
    at org.datanucleus.query.compiler.JDOQLParser.processExclusiveOrExpression(JDOQLParser.java:413)
    at org.datanucleus.query.compiler.JDOQLParser.processInclusiveOrExpression(JDOQLParser.java:399)
    at org.datanucleus.query.compiler.JDOQLParser.processConditionalAndExpression(JDOQLParser.java:385)
    at org.datanucleus.query.compiler.JDOQLParser.processConditionalOrExpression(JDOQLParser.java:366)
    at org.datanucleus.query.compiler.JDOQLParser.processExpression(JDOQLParser.java:355)
    at org.datanucleus.query.compiler.JDOQLParser.parse(JDOQLParser.java:93)
    at org.datanucleus.query.compiler.JavaQueryCompiler.compileFilter(JavaQueryCompiler.java:462)
    at org.datanucleus.query.compiler.JDOQLCompiler.compile(JDOQLCompiler.java:101)
    at org.datanucleus.store.query.AbstractJDOQLQuery.compileInternal(AbstractJDOQLQuery.java:302)
    at org.datanucleus.store.query.Query.compile(Query.java:1446)
    at org.datanucleus.jdo.JDOQuery.compile(JDOQuery.java:95)
    at net.x0ver.utilities.AbstractJdoRepository.executeQuery(AbstractJdoRepository.java:40)
    at net.x0ver.identitymanagement.persistence.JdoIdentityRepository.getIdentities(MyJdoRepository.java:29)
    at net.x0ver.identitymanagement.test.MainTest.main(MainTest.java:26)
Exception in thread "main" javax.jdo.JDOUserException: Invalid string literal (End of stream): identity.name == "Identity 0
    at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:396)
    at org.datanucleus.jdo.JDOQuery.compile(JDOQuery.java:99)
    at net.x0ver.utilities.AbstractJdoRepository.executeQuery(AbstractJdoRepository.java:40)
    at net.x0ver.identitymanagement.persistence.JdoIdentityRepository.getIdentities(MyJdoRepository.java:29)
    at net.x0ver.identitymanagement.test.MainTest.main(MainTest.java:26)
NestedThrowablesStackTrace:
Invalid string literal (End of stream): identity.name == "Identity 0
org.datanucleus.exceptions.NucleusUserException: Invalid string literal (End of stream): identity.name == "Identity 0
    at org.datanucleus.query.compiler.Lexer.parseStringLiteral(Lexer.java:689)
    at org.datanucleus.query.compiler.JDOQLParser.processLiteral(JDOQLParser.java:1012)
    at org.datanucleus.query.compiler.JDOQLParser.processPrimary(JDOQLParser.java:678)
    at org.datanucleus.query.compiler.JDOQLParser.processUnaryExpression(JDOQLParser.java:621)
    at org.datanucleus.query.compiler.JDOQLParser.processMultiplicativeExpression(JDOQLParser.java:547)
    at org.datanucleus.query.compiler.JDOQLParser.processAdditiveExpression(JDOQLParser.java:518)
    at org.datanucleus.query.compiler.JDOQLParser.processRelationalExpression(JDOQLParser.java:450)
    at org.datanucleus.query.compiler.JDOQLParser.processAndExpression(JDOQLParser.java:427)
    at org.datanucleus.query.compiler.JDOQLParser.processExclusiveOrExpression(JDOQLParser.java:413)
    at org.datanucleus.query.compiler.JDOQLParser.processInclusiveOrExpression(JDOQLParser.java:399)
    at org.datanucleus.query.compiler.JDOQLParser.processConditionalAndExpression(JDOQLParser.java:385)
    at org.datanucleus.query.compiler.JDOQLParser.processConditionalOrExpression(JDOQLParser.java:366)
    at org.datanucleus.query.compiler.JDOQLParser.processExpression(JDOQLParser.java:355)
    at org.datanucleus.query.compiler.JDOQLParser.parse(JDOQLParser.java:93)
    at org.datanucleus.query.compiler.JavaQueryCompiler.compileFilter(JavaQueryCompiler.java:462)
    at org.datanucleus.query.compiler.JDOQLCompiler.compile(JDOQLCompiler.java:101)
    at org.datanucleus.store.query.AbstractJDOQLQuery.compileInternal(AbstractJDOQLQuery.java:302)
    at org.datanucleus.store.query.Query.compile(Query.java:1446)
    at org.datanucleus.jdo.JDOQuery.compile(JDOQuery.java:95)
    at net.x0ver.utilities.AbstractJdoRepository.executeQuery(AbstractJdoRepository.java:40)
    at net.x0ver.identitymanagement.persistence.JdoIdentityRepository.getIdentities(MyJdoRepository.java:29)
    at net.x0ver.identitymanagement.test.MainTest.main(MainTest.java:26)
  • 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-16T20:26:07+00:00Added an answer on May 16, 2026 at 8:26 pm

    It seems that your query is not well formed. The exception indicates Invalid string litteral and, in your query sample, there is an unclosed double quote character. Maybe you should try something like that:

    query.setFilter("name == name_value");
    query.declareParameters("String name_value");
    query.execute(name);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have interface Foo public interface Foo { public void test(); } Class FooChild
I have next interface public interface IMyInterface { string this[string key] { get; set;
I have interface IConfigurationSource { .... } and class FileConfigurationSource : IConfigurationSource { FileConfigurationSource(string
I have an interface: public interface: IA { ... } and I try to
I have an Interface like this: namespace QuickRoutes.Model.Utilities { public interface IRoutesManager { bool
I have interface: public interface CartService extends RemoteService{ <T extends ActionResponse> T execute(Action<T> action);
I have a Device interface: public interface IDevice { double Measure(); } Some classes
I have the following class: @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class TclRequest
i have interface: public interface Inx<T> { T Set(Data data); } simple class with
Suppose I have: interface Foo { void doStuff(); } class FooImpl implements Foo {

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.