Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » problem about emf+jpox query
problem about emf+jpox query [message #98516] Mon, 08 October 2007 02:00 Go to next message
Eclipse UserFriend
Originally posted by: danceslower.sina.com

Hi All
There is a strange problem in object query during using emf+jpox.
There is a 1-n relation between Class Car and Class Part, which means one
Car contains n Parts. When I use this query:
////////////////////
query = pm.newQuery("javax.jdo.query.JDOQL", "SELECT FROM Part WHERE car ==
threshold");
query.declareImports("import Car");
query.declareParameters("Car threshold");
List results = (List)query.execute("BMW");
/////////////////////////////
Exception are throwed:
Exception in thread "main" java.lang.NullPointerException
at org.jpox.store.expression.UnboundVariable.eq(UnboundVariable .java:184)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileEquali tyExpression(JDOQLQuery.java:1609)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileAndExp ression(JDOQLQuery.java:1591)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExclus iveOrExpression(JDOQLQuery.java:1579)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileInclus iveOrExpression(JDOQLQuery.java:1567)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalAndExpression(JDOQLQuery.java:1555)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalOrExpression(JDOQLQuery.java:1537)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sion(JDOQLQuery.java:1514)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sionFromString(JDOQLQuery.java:1475)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileFilter (JDOQLQuery.java:1314)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.performCompil e(JDOQLQuery.java:924)
at
org.jpox.store.rdbms.query.JDOQLQuery$Compiler.executionComp ile(JDOQLQuery.java:897)
at
org.jpox.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQu ery.java:497)
at org.jpox.store.query.Query.executeWithMap(Query.java:959)
at org.jpox.store.query.Query.executeWithArray(Query.java:932)
at org.jpox.store.query.Query.execute(Query.java:855)
at test.TestQuery.queryPartData(TestQuery.java:34)
at test.TestQuery.main(TestQuery.java:18)

what is the meaning of that?
Re: problem about emf+jpox query [message #98531 is a reply to message #98516] Mon, 08 October 2007 07:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Wangyan,
In the call to query.execute you probably have to pass an instance of Car instead of a String.

gr. Martin

wangyan wrote:
> Hi All
> There is a strange problem in object query during using emf+jpox.
> There is a 1-n relation between Class Car and Class Part, which means one
> Car contains n Parts. When I use this query:
> ////////////////////
> query = pm.newQuery("javax.jdo.query.JDOQL", "SELECT FROM Part WHERE car ==
> threshold");
> query.declareImports("import Car");
> query.declareParameters("Car threshold");
> List results = (List)query.execute("BMW");
> /////////////////////////////
> Exception are throwed:
> Exception in thread "main" java.lang.NullPointerException
> at org.jpox.store.expression.UnboundVariable.eq(UnboundVariable .java:184)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileEquali tyExpression(JDOQLQuery.java:1609)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileAndExp ression(JDOQLQuery.java:1591)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExclus iveOrExpression(JDOQLQuery.java:1579)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileInclus iveOrExpression(JDOQLQuery.java:1567)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalAndExpression(JDOQLQuery.java:1555)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalOrExpression(JDOQLQuery.java:1537)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sion(JDOQLQuery.java:1514)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sionFromString(JDOQLQuery.java:1475)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileFilter (JDOQLQuery.java:1314)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.performCompil e(JDOQLQuery.java:924)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.executionComp ile(JDOQLQuery.java:897)
> at
> org.jpox.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQu ery.java:497)
> at org.jpox.store.query.Query.executeWithMap(Query.java:959)
> at org.jpox.store.query.Query.executeWithArray(Query.java:932)
> at org.jpox.store.query.Query.execute(Query.java:855)
> at test.TestQuery.queryPartData(TestQuery.java:34)
> at test.TestQuery.main(TestQuery.java:18)
>
> what is the meaning of that?
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: problem about emf+jpox query [message #609905 is a reply to message #98516] Mon, 08 October 2007 07:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Wangyan,
In the call to query.execute you probably have to pass an instance of Car instead of a String.

gr. Martin

wangyan wrote:
> Hi All
> There is a strange problem in object query during using emf+jpox.
> There is a 1-n relation between Class Car and Class Part, which means one
> Car contains n Parts. When I use this query:
> ////////////////////
> query = pm.newQuery("javax.jdo.query.JDOQL", "SELECT FROM Part WHERE car ==
> threshold");
> query.declareImports("import Car");
> query.declareParameters("Car threshold");
> List results = (List)query.execute("BMW");
> /////////////////////////////
> Exception are throwed:
> Exception in thread "main" java.lang.NullPointerException
> at org.jpox.store.expression.UnboundVariable.eq(UnboundVariable .java:184)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileEquali tyExpression(JDOQLQuery.java:1609)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileAndExp ression(JDOQLQuery.java:1591)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExclus iveOrExpression(JDOQLQuery.java:1579)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileInclus iveOrExpression(JDOQLQuery.java:1567)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalAndExpression(JDOQLQuery.java:1555)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCondit ionalOrExpression(JDOQLQuery.java:1537)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sion(JDOQLQuery.java:1514)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileExpres sionFromString(JDOQLQuery.java:1475)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileFilter (JDOQLQuery.java:1314)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.performCompil e(JDOQLQuery.java:924)
> at
> org.jpox.store.rdbms.query.JDOQLQuery$Compiler.executionComp ile(JDOQLQuery.java:897)
> at
> org.jpox.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQu ery.java:497)
> at org.jpox.store.query.Query.executeWithMap(Query.java:959)
> at org.jpox.store.query.Query.executeWithArray(Query.java:932)
> at org.jpox.store.query.Query.execute(Query.java:855)
> at test.TestQuery.queryPartData(TestQuery.java:34)
> at test.TestQuery.main(TestQuery.java:18)
>
> what is the meaning of that?
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:problem about emf+jpox query
Next Topic:Modelling XSD using EMF
Goto Forum:
  


Current Time: Thu Apr 25 04:35:54 GMT 2024

Powered by FUDForum. Page generated in 0.03167 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top