![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 14
|
|
| Author |
|
|
Novice Joined: May 19, 2004 Post Count: 46 Status: Offline |
Hello, How can I define Named-Query through XDoclet ? Eric |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
How can I define Named-Query through XDoclet ? Ask on the XDoclet mailing list maybe since it is nothing to do with JPOX. ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Expert Germany Joined: Mar 15, 2004 Post Count: 766 Status: Offline |
Hello Andy, I'm currently implementing XDoclet support for @jdo.query, but I wonder why the attribute name is defined as #IMPLIED in the DTD instead of #REQUIRED. What is the default name if I omit the declaration? Or is this an error in the DTD? I guess, language defaults to javax.jdo.query.JDOQL if omitted, right? Is it correct, that language can be one of the following values (and nothing different)?
Marco ![]() ---------------------------------------- Best regards, Marco ![]() jfire: free erp, crm, scm and more |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
I'm currently implementing XDoclet support for @jdo.query, Excellent. but I wonder why the attribute name is defined as #IMPLIED in the DTD instead of #REQUIRED. What is the default name if I omit the declaration? Or is this an error in the DTD? I'd expect it to be REQUIRED, 'cos a named query without a name is as much use as a chocolate teapot ![]() I guess, language defaults to javax.jdo.query.JDOQL if omitted, right? Yes. Is it correct, that language can be one of the following values (and nothing different)?
The JDO2 supported values are javax.jdo.query.JDOQL and javax.jdo.query.SQL. JPOX also supports "javax.jdo.query.JPOXSQL". But you should allow people to put in what they want and then if we add OQL or HQL or something else in the future then it is accepted. ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Expert Germany Joined: Mar 15, 2004 Post Count: 766 Status: Offline |
I'd expect it to be REQUIRED, 'cos a named query without a name is as much use as a chocolate teapot ![]() You're right - I've made it required in XDoclet. But you should allow people to put in what they want OK. I won't check and only add the possible values to the documentation. So, people have to search for their typos themselves ![]() A query tag now looks like this: @jdo.queryIf you agree with the param "expression", I'll check it in to XDoclet-CVS... Or any better naming idea for the query itself? Maybe "text" or "query"? It's shorter... Marco ![]() ---------------------------------------- Best regards, Marco ![]() jfire: free erp, crm, scm and more |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
A query tag now looks like this: @jdo.queryIf you agree with the param "expression", I'll check it in to XDoclet-CVS... The JDO spec doesn't provide a name, and "expression" sounds fine to me ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Expert Belgium Joined: Mar 12, 2004 Post Count: 2991 Status: Offline |
From the latest discussion in EG, I expect that the operation pm.newQuery(Class cls,String filter) will be renamed to pm.newQuery(Class cls,String query), so maybe it's better use query instead of expression ---------------------------------------- Erik Bengtson ![]() |
||
|
|
Expert Germany Joined: Mar 15, 2004 Post Count: 766 Status: Offline |
Hello! OK, I've renamed "expression" to "query" (is shorter anyway). Therefore, an example tag looks now like this: @jdo.queryI've still some questions:
Best regards, Marco ![]() ---------------------------------------- Best regards, Marco ![]() jfire: free erp, crm, scm and more---------------------------------------- [Edit 2 times, last edit by nlmarco at Mar 19, 2005 5:16:56 PM] |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
Why is the query defined within a class (according to the DTD query is a child element of class)? Does that mean, the declared name is within a namespace? It is defined EITHER for a class or within a file. If within a class the query doesnt need to include the candidate class name. Why do I have to declare a "FROM"? When I obtain the query via pm.newNamedQuery(Class clazz, String queryName), I define the class already... What happens, if these two classes differ? Or is the first parameter of newNamedQuery the namespace? See above. You dont have to define the candidate class when you define your query within a <class> Is it a minor bug in JPOX that I need to use fully qualified class names in the query expression (short name in FROM clause failed) or is it required by the spec? The query expression has to have the fully qualified class because otherwise how would JPOX know where the class is from ? See above regarding specifying named queries in <class> ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Expert Germany Joined: Mar 15, 2004 Post Count: 766 Status: Offline |
Hello Andy, thanks for the info! Seems, I overlooked the possibility that "query" can be a child element of "jdo" directly. @Andy & Erik: Well, concerning XDoclet, I've a little problem then: In XDoclet, all tags are written into a java-file and therefore attached to a class. Hence, if I use only the tag @jdo.query, I can't know whether this query should be global or relative within the current class. To solve this, there are two possibilities: Either I use two different tags - e.g. @jdo.classquery and @jdo.globalquery - or I use an optional parameter global="yes|no". I prefer the latter version and I would default global to no (because this is probably more common). What do you think? BTW: I've tried to omit the FROM xxx and it works fine! Thanks for this hint! Makes life much easier. edit: 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? 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)? ---------------------------------------- Best regards, Marco ![]() jfire: free erp, crm, scm and more---------------------------------------- [Edit 2 times, last edit by nlmarco at Mar 19, 2005 5:41:13 PM] |
||
|
|
|
|
|
Current timezone is GMT May 17, 2012 11:03:16 AM |