RE: Subqueries in ODMG query
Thanks, but I was looking for something using ODMG-API, not PB-API. I did find this test case and my query looks similar except that I have 2 different object types in my query. /** + * test Subquery + * get all articles with price > avg(price) + * PROBLEM: avg(price) is NOT extent aware !! + * + * test may fail if db does not support sub queries + */ +public void _testSubQuery1() throws Exception +{ +Implementation odmg = OJB.getInstance(); +Database db = odmg.newDatabase(); +db.open(databaseName, Database.OPEN_READ_WRITE); + +Transaction tx = odmg.newTransaction(); +tx.begin(); + +OQLQuery query = odmg.newOQLQuery(); +query.create("select anArticle from " + +Article.class.getName() + +" where " + +" price >= (select avg(price) from " + +Article.class.getName() + +" where articleName like \"A%\") "); + +List results = (List) query.execute(); +tx.commit(); +assertTrue(results.size() > 0); +db.close(); +} ->-Original Message- ->From: Vasily Ivanov [mailto:[EMAIL PROTECTED] ->Sent: Thursday, March 23, 2006 9:22 PM ->To: OJB Users List ->Subject: Re: Subqueries in ODMG query -> ->http://db.apache.org/ojb/docu/guides/query.html#subqueries -> ->On 3/24/06, Eric Kelm <[EMAIL PROTECTED]> wrote: ->> Is it possible to use a subquery inside of an ODMG query e.g. ->> ->> select jobs from " + JobBO.class.getName(); where ->employees_idemployee ->> = " + employee.getIdEmployee(); idjob like $1 or idtask_code like ->>(select task_codes from " + TaskCodeBO.class.getName(); ->> where task_code_name like $2 ->>) ->> ->> If this is not correct syntax (seems not to be) can someone ->point me ->> in the right direction? Thanks ->> ->> ->> ->> ->- ->> To unsubscribe, e-mail: [EMAIL PROTECTED] ->> For additional commands, e-mail: [EMAIL PROTECTED] ->> ->> -> ->- ->To unsubscribe, e-mail: [EMAIL PROTECTED] ->For additional commands, e-mail: [EMAIL PROTECTED] -> -> -> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Subqueries in ODMG query
http://db.apache.org/ojb/docu/guides/query.html#subqueries On 3/24/06, Eric Kelm <[EMAIL PROTECTED]> wrote: > Is it possible to use a subquery inside of an ODMG query e.g. > > select jobs from " + JobBO.class.getName(); > where employees_idemployee = " + employee.getIdEmployee(); > idjob like $1 or idtask_code like >(select task_codes from " + TaskCodeBO.class.getName(); > where task_code_name like $2 >) > > If this is not correct syntax (seems not to be) can someone point me in the > right direction? Thanks > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Subqueries in ODMG query
Sorry mistyped Is it possible to use a subquery inside of an ODMG query e.g. select jobs from " + JobBO.class.getName(); where employees_idemployee = " + employee.getIdEmployee() + " and (idjob like $1 or idtask_code like (select task_codes from " + TaskCodeBO.class.getName(); where task_code_name like $2 )) If this is not correct syntax (seems not to be) can someone point me in the right direction? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Subqueries in ODMG query
Is it possible to use a subquery inside of an ODMG query e.g. select jobs from " + JobBO.class.getName(); where employees_idemployee = " + employee.getIdEmployee(); idjob like $1 or idtask_code like (select task_codes from " + TaskCodeBO.class.getName(); where task_code_name like $2 ) If this is not correct syntax (seems not to be) can someone point me in the right direction? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
auto delete and foreign keys
Hello, Yes another question again. I have a class Area that is referencing a class Point, and Area has a foreign key constraint on Point. I'am using ODMG, and i would like OJB to delete the Point when i delete the Area. What happens is that when i commit a transaction for removing an Area, OJB is trying to remove the Point but of course it can't because the foreing key constraint is violated as the Area is still referencing the point. So i suppose the Area should be removed first for this to work. Do you think it can be a bug ? Do i have to manually unreference the point somewhere ? Thank you. Jean-Yves P.S.: I'am not a foreign key constraint expert, but i tried to use deferrable=true for this constraint and it does not work neither.
Re: Tutorials
Take a look at this http://apache.org/dist/db/ojb/db-ojb-1.0.4/webapp-sample.jar. This is a good example of using OJB, Struts and JSP all together. On 3/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey everybody, > > are there any Tutorials that you can advice for learning to use the OJB > especially in the JSP Context. I want to try to self study using ojb... > > I am developing on Eclipse Version3 and the Server is a Tomcat V5. > > Thanks a lot !! > > Caddy > > Hint : I know that there are some on the OJB HomePage... > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tutorials
Hey everybody, are there any Tutorials that you can advice for learning to use the OJB especially in the JSP Context. I want to try to self study using ojb... I am developing on Eclipse Version3 and the Server is a Tomcat V5. Thanks a lot !! Caddy Hint : I know that there are some on the OJB HomePage... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]