![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 14
|
|
| Author |
|
|
Expert Belgium Joined: Mar 12, 2004 Post Count: 2991 Status: Offline |
I agree with you. and also don't get why the FROM clause is there. The namespace for queries has its boundaries in this package and super packages from the spec The file search order for a query scoped to class com.sun.nb.Bar is: META-INF/package. jdo, WEB-INF/package.jdo, package.jdo, com/package.jdo, com/sun/package.jdo, com/sun/nb/package.jdo, com/sun/nb/Bar.jdo If the metadata is not found in the above, and there is a property in the PersistenceManagerFactory javax.jdo.option.Mapping=mySQL, then the folowing files are searched: META-INF/package-mySQL.orm, WEB-INF/package-mySQL.orm, packagemySQL. orm, com/package-mySQL.orm, com/sun/package-mySQL.orm, com/sun/nb/ package-mySQL.orm, com/sun/nb/Bar-mySQL.orm. If metadata is not found in the above, then the following files are searched: META-INF/ package.jdoquery, WEB-INF/package.jdoquery, package.jdoquery, com/package. jdoquery, com/sun/package.jdoquery, com/sun/nb/package.jdoquery, com/sun/ nb/Bar.jdoquery. ---------------------------------------- Erik Bengtson ![]() |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
Still, it's not yet clear to me, what the first parameter of pm.newNamedQuery(...) is doing. Because if I write my <query/> within a <class/> element, the class is clear. If I don't, then I must declare a FROM xxx (do I?), so what's that parameter doing? Well we weren't on the EG when that was decided so I can only guess. My assumption (and what JPOX assumes also) was that the class parameter to newNamedQuery() was used to determine the namespace of the query name. So if the user specifies a class then that named query "name" is in the namespace of that class ... and also the class name is subsitituted into the query (as we mentioned before). When the user doesnt provide a class to newNamedQuery() then the query is a "global" query, and the named query name is in the "global" namespace - and so the user has to specify the candidate class name directly in the query. The spec doesnt do what I would expect a spec to do ... that is, specify And only to be sure: Did I understand it correctly then, that the name of the query must be unique within my whole project (no namespaces)? See above for my interpretation of namespaces of named queries. ---------------------------------------- -Andy ![]() ![]() ---------------------------------------- [Edit 1 times, last edit by andy at Mar 19, 2005 6:23:58 PM] |
||
|
|
Newbie India Joined: May 31, 2010 Post Count: 2 Status: Offline |
Hi Andy When the user doesnt provide a class to newNamedQuery() then the query is a "global" query, and the named query name is in the "global" namespace - and so the user has to specify the candidate class name directly in the query. What should be the class name when we want the named query in global namespace ? Can i set the class name to null ? newNamedQuery(null, query) ? Thanks -Dinu |
||
|
|
Newbie India Joined: May 31, 2010 Post Count: 2 Status: Offline |
Hi, Has any one tried named query in global namespace, i.e not pertaining to any particular class ? Thanks Dinu John |
||
|
|
|
|
|
Current timezone is GMT May 17, 2012 11:02:52 AM |