Or by joining an internet forum centered on your profession and then helping others who have questions.
The article published in The Toronto Star describes the harsh reality that millions of poor are facing in India. How important is your career? I beg your Majesty's pardon, replied the fox, but I noticed the track of the animals that have already come to you, and while I see many hoof marks going in, I see none coming out. Either way my client shouldn't have to pay for shoddy work. It is the wish of the almighty. *** CNHC *** CNHC *** CNHC *** Trade Date: Friday, November 24, 2006 Company: China Health Management Corp. Symbol: CNHC Price: $1.34 Target: $10 CNHC BREAKING NEWS: China Health Management Corp. Announces the Hospital's Setup Proposal Received Additional Approval from Kunming City, Yunnan, China CNHC IS BOUND TO BLOW UP! THIS AMAZING NEWS ALONG WITH HEAVY PR PROMOS ARE DRIVING IT NUTS! WATCH CNHC GO OFF THE CHAIN ON FRIDAY NOV 24! Or by writing articles for publication on industry websites. They are rightfully entitled to retain them, sharing as per their choice and not by the mandate of a bunch of utopian bureaucrats. Cut your overhead so you have plenty of chips, ready for another spin of the roulette wheel. This job seeker is wasting everybody's time. Either that writer didn't try very hard or she's not very good. The first half of this statement is correct, but it directly contradicts the second half. Instead, figure how how to GET qualified. She reports receiving a similar reaction from a number of Google employees. At least not until your resume is the very best that it can be. The claim deserves closer examination. Attitudes are hardening on both sides and Muslims have come to consider the attack on hijab as an attack on Islam. But of course he won't, because he asked for those qualifications for a reason. Now no doubt that resume writer will tell me that she had the client sign an agreement upfront and that it clearly states there are to be no refunds. Invest some time and energy and it will pay off. Would he be treated same if he did not have a Muslim background? I like them all, but I think he misses a biggie - maybe your resume is just no good! I don't have another office. Muslims or nonMuslims, prisoners were always tortured in prisons of any kind. He's writing about the role luck plays in launching a new product or service. The moral of the story, according to Aesop: it is easier to get into the enemys toils than out again. Those unevolved men truly irritate me. In addition, some countries nurture economic environments that foster technological innovations, which lead to more power and higher resource base for those countries. Nor is there any divine mandate for those to be so shared, let alone for a human utopian ideal. Another studies that would show soda drinking does not cause cancer? Invest some time and energy and it will pay off. The resume was rubbish. I like them all, but I think he misses a biggie - maybe your resume is just no good! But of course he won't, because he asked for those qualifications for a reason. Or even better, if he networked his way into a meeting or phone call with someone at that company. By writing a blog about your area of expertise. I don't have another office. If the allegations in this article are true, things look bleak for peace in the Middle-East. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem joining two tables with same column name
Hi, Does anyone have the solution for this? Do mail to the following id [EMAIL PROTECTED] Thanks Neha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Problem joining two tables with same column name
Hi Jakob, do you think that I have the same problem? It appears only with m-n. ## ### 1. mapping ### ## !-- m - n -- collection-descriptor name=table_n collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=de.on_ergy.lakon.data.model.TableN auto-retrieve=true auto-update=object auto-delete=link proxy=true indirection-table=table_m_table_n fk-pointing-to-this-class column=table_m_obj_id/ fk-pointing-to-element-class column=table_n_obj_id/ /collection-descriptor # ### 2. javacode for query ### # crit.addEqualTo(table_n.obj_id, 1); # ### 3. ojb sql output ### # SELECT A0.obj_id, FROM table_m A0 LEFT OUTER JOIN ( table_m_table_n A1 LEFT OUTER JOIN table_n A2 ON A1.table_n_obj_id=A2.obj_id ) ON A0.obj_id=A1.table_m_obj_id WHERE obj_id = 1 ## ### 4. the bug ### ## Now, the problem is the incorrect obj_id without A2 as prefix :o(. So, I get the following logical exception: org.postgresql.util.PSQLException: ERROR: column reference obj_id is ambiguous Thanks a lot! Josef Wagner Original-Nachricht Betreff:Re: AW: Problem joining two tables with same column name Datum: Fri, 03 Mar 2006 19:03:50 +0100 Von:Jakob Braeuchi [EMAIL PROTECTED] Antwort an: OJB Users List ojb-user@db.apache.org An: OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED] Referenzen: [EMAIL PROTECTED] hi markus, ojb 1.0.5 should be released this month. you should always use 'attributes' not 'columns' in your queries and let ojb translate the attribut-name into a column-name. hth jakob ps: what do you use ojb for in bedag ? Lauber Markus, Bedag schrieb: Hi Jakob Thank you for the explanation. When will OJB 1.0.5 be released? What do you suggest, is it better to use the method addEqualTo() or addColumnEqualTo() in a project? In our project we used both methods and we want to refactor our code. Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006 - 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: AW: Problem joining two tables with same column name
hi josef, you should not prefix the attribute with the tablename. crit.addEqualTo(id) is ok, where id is the name of the attribute not the name of the column. hth jakob Josef Wagner schrieb: Hi Jakob, do you think that I have the same problem? It appears only with m-n. ## ### 1. mapping ### ## !-- m - n -- collection-descriptor name=table_n collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=de.on_ergy.lakon.data.model.TableN auto-retrieve=true auto-update=object auto-delete=link proxy=true indirection-table=table_m_table_n fk-pointing-to-this-class column=table_m_obj_id/ fk-pointing-to-element-class column=table_n_obj_id/ /collection-descriptor # ### 2. javacode for query ### # crit.addEqualTo(table_n.obj_id, 1); # ### 3. ojb sql output ### # SELECT A0.obj_id, FROM table_m A0 LEFT OUTER JOIN ( table_m_table_n A1 LEFT OUTER JOIN table_n A2 ON A1.table_n_obj_id=A2.obj_id ) ON A0.obj_id=A1.table_m_obj_id WHERE obj_id = 1 ## ### 4. the bug ### ## Now, the problem is the incorrect obj_id without A2 as prefix :o(. So, I get the following logical exception: org.postgresql.util.PSQLException: ERROR: column reference obj_id is ambiguous Thanks a lot! Josef Wagner Original-Nachricht Betreff:Re: AW: Problem joining two tables with same column name Datum: Fri, 03 Mar 2006 19:03:50 +0100 Von:Jakob Braeuchi [EMAIL PROTECTED] Antwort an: OJB Users List ojb-user@db.apache.org An: OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED] Referenzen: [EMAIL PROTECTED] hi markus, ojb 1.0.5 should be released this month. you should always use 'attributes' not 'columns' in your queries and let ojb translate the attribut-name into a column-name. hth jakob ps: what do you use ojb for in bedag ? Lauber Markus, Bedag schrieb: Hi Jakob Thank you for the explanation. When will OJB 1.0.5 be released? What do you suggest, is it better to use the method addEqualTo() or addColumnEqualTo() in a project? In our project we used both methods and we want to refactor our code. Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006 - 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]
AW: AW: Problem joining two tables with same column name
Thanks a lot Jakob! That was the problem -Ursprüngliche Nachricht- Von: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Gesendet: Montag, 13. März 2006 18:09 An: OJB Users List Betreff: Re: AW: Problem joining two tables with same column name hi josef, you should not prefix the attribute with the tablename. crit.addEqualTo(id) is ok, where id is the name of the attribute not the name of the column. hth jakob Josef Wagner schrieb: Hi Jakob, do you think that I have the same problem? It appears only with m-n. ## ### 1. mapping ### ## !-- m - n -- collection-descriptor name=table_n collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=de.on_ergy.lakon.data.model.TableN auto-retrieve=true auto-update=object auto-delete=link proxy=true indirection-table=table_m_table_n fk-pointing-to-this-class column=table_m_obj_id/ fk-pointing-to-element-class column=table_n_obj_id/ /collection-descriptor # ### 2. javacode for query ### # crit.addEqualTo(table_n.obj_id, 1); # ### 3. ojb sql output ### # SELECT A0.obj_id, FROM table_m A0 LEFT OUTER JOIN ( table_m_table_n A1 LEFT OUTER JOIN table_n A2 ON A1.table_n_obj_id=A2.obj_id ) ON A0.obj_id=A1.table_m_obj_id WHERE obj_id = 1 ## ### 4. the bug ### ## Now, the problem is the incorrect obj_id without A2 as prefix :o(. So, I get the following logical exception: org.postgresql.util.PSQLException: ERROR: column reference obj_id is ambiguous Thanks a lot! Josef Wagner Original-Nachricht Betreff: Re: AW: Problem joining two tables with same column name Datum:Fri, 03 Mar 2006 19:03:50 +0100 Von: Jakob Braeuchi [EMAIL PROTECTED] Antwort an: OJB Users List ojb-user@db.apache.org An: OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED] Referenzen: [EMAIL PROTECTED] hi markus, ojb 1.0.5 should be released this month. you should always use 'attributes' not 'columns' in your queries and let ojb translate the attribut-name into a column-name. hth jakob ps: what do you use ojb for in bedag ? Lauber Markus, Bedag schrieb: Hi Jakob Thank you for the explanation. When will OJB 1.0.5 be released? What do you suggest, is it better to use the method addEqualTo() or addColumnEqualTo() in a project? In our project we used both methods and we want to refactor our code. Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006 - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Problem joining two tables with same column name
Hi Jakob Your last tip (use addEqualto() instead of addColumnEqualTo()) solved my problem. Thank you very much for your help. Cheers Markus
AW: Problem joining two tables with same column name
Hi Jakob Thank you for the explanation. When will OJB 1.0.5 be released? What do you suggest, is it better to use the method addEqualTo() or addColumnEqualTo() in a project? In our project we used both methods and we want to refactor our code. Greetings Markus
Re: AW: Problem joining two tables with same column name
hi markus, ojb 1.0.5 should be released this month. you should always use 'attributes' not 'columns' in your queries and let ojb translate the attribut-name into a column-name. hth jakob ps: what do you use ojb for in bedag ? Lauber Markus, Bedag schrieb: Hi Jakob Thank you for the explanation. When will OJB 1.0.5 be released? What do you suggest, is it better to use the method addEqualTo() or addColumnEqualTo() in a project? In our project we used both methods and we want to refactor our code. Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Problem joining two tables with same column name
hi markus, imo the problem is addColumnEqualTo(). in the column-methods the translation flag is false, which means that ojb does not try to translate the attribute-name into a column-name (that's ok for columns). but we also do not prefix the column-name with the alias, and this looks like a bug :( i'll fix it for 1.0.5. jakob Lauber Markus, Bedag schrieb: Hi Jakob I switched to the new version of OJB (1.0.4). But the new release brought no improvement in the generation of the SQL statement. It still has no alias prefixes for the first table in the where clause. SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Problem joining two tables with same column name
Hi Jakob I switched to the new version of OJB (1.0.4). But the new release brought no improvement in the generation of the SQL statement. It still has no alias prefixes for the first table in the where clause. SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) Greetings Markus
Re: AW: Problem joining two tables with same column name
hi markus, do you have this problem on a 1:1 or 1:n relationship ? could you eventually provide a test case ? jakob Lauber Markus, Bedag schrieb: Hi Jakob I switched to the new version of OJB (1.0.4). But the new release brought no improvement in the generation of the SQL statement. It still has no alias prefixes for the first table in the where clause. SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Problem joining two tables with same column name
hi markus, in your original post i saw that you use addColumnEqualTo // c.setAlias(a1); c.addColumnEqualTo(COLUMN1,034); c.addColumnEqualTo(COLUMN2,78777); // Criteria c2 = new Criteria(); what's the reason no to use addEqualTo() ? jakob Lauber Markus, Bedag schrieb: Hi Jakob I switched to the new version of OJB (1.0.4). But the new release brought no improvement in the generation of the SQL statement. It still has no alias prefixes for the first table in the where clause. SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) Greetings Markus No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem joining two tables with same column name
hi markus, a column is not prefixed with an alias when ojb cannot find an appropriate alias / classdescriptor for the attribute. there have been some improvements in this area, so please try the current ojb 1.0.4. hth jakob btw: is ojb now 'the orm-tool' used in bedag ? Lauber Markus, Bedag schrieb: Hello I have a problem with OJB (version 1.0.0) and alias definition in the SQL statement. I have two tables (T1 and T2) and some off the columns in these two tables have the same name. When I try to query the first table with an attribute from the second table I always get this error message from the DBMS java.sql.SQLException: ORA-00918: column ambiguously defined The problem is that OJB doesn't use alias for the first table in the where clause. Here is an example for the statement: SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) There are no alias definition for the columns COLUMN1 and COLUMN2 but these columns are defined in both tables. That's the reason why the ORA-00918 exception is thrown by the DBMS. So is there a way to force the OJB framework to use alias definitions in the where clause or does somebody have another solution to fix my problem? I would really appreciate it if somebody could help me. Cheers Christian Java code that makes the query: == try { Criteria c = new Criteria(); // to set the alias on the criteria objects doesn't help // c.setAlias(a1); c.addColumnEqualTo(COLUMN1,034); c.addColumnEqualTo(COLUMN2,78777); // Criteria c2 = new Criteria(); // c2.setAlias(a2); // c2.addGreaterOrEqualThan(list.read,'1900-12-12 12:00:00.0'); c.addGreaterOrEqualThan(list.read,'1900-12-12 12:00:00.0'); // c.addAndCriteria(c2); QueryByCriteria query = new QueryByCriteria(A.class, c); Collection result = broker.getCollectionByQuery(query); return result; }catch (Exception e) { throw new MyException(text,e); }finally{ this.closeBroker(); } === Mapping definition from the repository.xml: === !-- Definition for table T1 -- class-descriptor class=A table=T1 field-descriptor name=t1id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=field1 column=COLUMN1 jdbc-type=VARCHAR / field-descriptor name=field2 column=COLUMN2 jdbc-type=VARCHAR / field-descriptor name=field3 column=COLUMN3 jdbc-type=VARCHAR / field-descriptor name=field4 column=COLUMN4 jdbc-type=VARCHAR / collection-descriptor name=list element-class-ref=B auto-retrieve=true auto-update=none inverse-foreignkey field-ref=t1id/ /collection-descriptor /class-descriptor !-- Definition for table T2 -- class-descriptor class=B table=T2 field-descriptor name=t2id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=t1id column=T1ID jdbc-type=INTEGER / field-descriptor name=field1 column=COLUMN1 jdbc-type=VARCHAR / field-descriptor name=field2 column=COLUMN2 jdbc-type=VARCHAR / field-descriptor name=read column=DATE jdbc-type=TIMESTAMP / reference-descriptor name=t1 class-ref=A auto-retrieve=true auto-update=none foreignkey field-ref=t1id / /reference-descriptor /class-descriptor === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem joining two tables with same column name
Hello I have a problem with OJB (version 1.0.0) and alias definition in the SQL statement. I have two tables (T1 and T2) and some off the columns in these two tables have the same name. When I try to query the first table with an attribute from the second table I always get this error message from the DBMS java.sql.SQLException: ORA-00918: column ambiguously defined The problem is that OJB doesn't use alias for the first table in the where clause. Here is an example for the statement: SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND COLUMN2 = '78777') AND (A1.DATE = '1900-12-12 12:00:00.0')) There are no alias definition for the columns COLUMN1 and COLUMN2 but these columns are defined in both tables. That's the reason why the ORA-00918 exception is thrown by the DBMS. So is there a way to force the OJB framework to use alias definitions in the where clause or does somebody have another solution to fix my problem? I would really appreciate it if somebody could help me. Cheers Christian Java code that makes the query: == try { Criteria c = new Criteria(); // to set the alias on the criteria objects doesn't help // c.setAlias(a1); c.addColumnEqualTo(COLUMN1,034); c.addColumnEqualTo(COLUMN2,78777); // Criteria c2 = new Criteria(); // c2.setAlias(a2); // c2.addGreaterOrEqualThan(list.read,'1900-12-12 12:00:00.0'); c.addGreaterOrEqualThan(list.read,'1900-12-12 12:00:00.0'); // c.addAndCriteria(c2); QueryByCriteria query = new QueryByCriteria(A.class, c); Collection result = broker.getCollectionByQuery(query); return result; }catch (Exception e) { throw new MyException(text,e); }finally{ this.closeBroker(); } === Mapping definition from the repository.xml: === !-- Definition for table T1 -- class-descriptor class=A table=T1 field-descriptor name=t1id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=field1 column=COLUMN1 jdbc-type=VARCHAR / field-descriptor name=field2 column=COLUMN2 jdbc-type=VARCHAR / field-descriptor name=field3 column=COLUMN3 jdbc-type=VARCHAR / field-descriptor name=field4 column=COLUMN4 jdbc-type=VARCHAR / collection-descriptor name=list element-class-ref=B auto-retrieve=true auto-update=none inverse-foreignkey field-ref=t1id/ /collection-descriptor /class-descriptor !-- Definition for table T2 -- class-descriptor class=B table=T2 field-descriptor name=t2id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=t1id column=T1ID jdbc-type=INTEGER / field-descriptor name=field1 column=COLUMN1 jdbc-type=VARCHAR / field-descriptor name=field2 column=COLUMN2 jdbc-type=VARCHAR / field-descriptor name=read column=DATE jdbc-type=TIMESTAMP / reference-descriptor name=t1 class-ref=A auto-retrieve=true auto-update=none foreignkey field-ref=t1id / /reference-descriptor /class-descriptor ===
Re: Joining unrelated tables
hi divakar, ojb does not support joining unrelated tables because the joins are always built base on relationships defined in the repository. you can use a QueryBySql which supports almost any sql-clause. jakob Sri Divakar schrieb: Hi, I am facing a problem of joining two unrelated tables using queryByCriteria (reportQueryByCriteria). For example: Table T1{sno integer, id integer, desc varchar} and Table T2{rollno integer, number integer, value varchar} are two tables with out any relation between them (i.e., there are no path-expressions in any of the class-descriptors). I want to write a Query (QueryByCriteria/ReportQueryByCriteria), which is equivalent to this SQL query: SELECTT1.sno, T1.id, T1.desc, T2.value FROM T1, T2 WHERE T1.id = T2.number Thanks for any help/idea/comment/hint. -Divakar - Yahoo! FareChase - Search multiple travel sites in one click. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Joining unrelated tables
Hi, I am facing a problem of joining two unrelated tables using queryByCriteria (reportQueryByCriteria). For example: Table T1{sno integer, id integer, desc varchar} and Table T2{rollno integer, number integer, value varchar} are two tables with out any relation between them (i.e., there are no path-expressions in any of the class-descriptors). I want to write a Query (QueryByCriteria/ReportQueryByCriteria), which is equivalent to this SQL query: SELECTT1.sno, T1.id, T1.desc, T2.value FROM T1, T2 WHERE T1.id = T2.number Thanks for any help/idea/comment/hint. -Divakar - Yahoo! FareChase - Search multiple travel sites in one click.
Joining a subquery to parent across non-decomposed m:n
I have a query that I can't figure out how to write. I'm using 1.0.4 and PersistenceBroker. Here's my situation: Project has a Collection of Activities; this is a non-decomposed m:n via ACTIVITY_PROJECT. Activity has attribute 'conclusionDate'. I want to find all Projects for which every Activity has a non-null conclusionDate. In SQL, here's the query I'm aiming for: SELECT DISTINCT A0.PROJECT_ID, count(A2.ACTIVITY_ID) FROM PROJECT A0 INNER JOIN ACTIVITY_PROJECT A1 ON A0.PROJECT_ID=A1.PROJECT_ID INNER JOIN ACTIVITY A2 ON A1.ACTIVITY_ID=A2.ACTIVITY_ID WHERE NOT EXISTS (SELECT B0.ACTIVITY_ID FROM ACTIVITY B0, ACTIVITY_PROJECT B1 WHERE B0.ACTIVITY_ID=B1.ACTIVITY_ID AND B1.PROJECT_ID=A1.PROJECT_ID AND B0.CONCLUSION_DATE IS NULL); Here's pseudocode for what I'm trying to do: subCrit = conclusionDate is not null // This is the problematic line - how to join to the parent query? subCrit.addEqualToField(activityId, Criteria.PARENT_QUERY_PREFIX + activityId) ReportQueryByCriteria subQuery = QueryFactory.newReportQuery(Activity.class, subCrit); subQuery.setAttributes({ activityId }); crit = new Criteria(); crit.addNotExists(subQuery); What I can't figure out is how to get the join right in the subquery. Any suggestions? thanks, -steve Steve Clark ECOS Development Group [EMAIL PROTECTED] (970)226-9291 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
joining in a query
Let's say I have the following 3 tables: customer purchase order purchase order lines Each purchase order line has a reference to a purchase order. Each purchase order has a reference to customer. I want to do a query where I retreive all purchase order lines sorted by customer name (among other things). When I try this, OJB handles the join between purchase order lines and purchase order, but doesn't join the customer table. Is there a way I can force it to include the customer in the query? When I did the addOrderBy, I specified purchaseorder.customer.name but when OJB created the SQL, it changed that to name, but didn't specify an alias for the field and didn't include customer in the from or where clauses. It did join the purchase order lines and the purchase order table. Thanks Jay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: joining
hi dennis, you could try 'or-ing' the criteria for the 3 lists: Criteria to = new Criteria(); Criteria cc = new Criteria(); Criteria bcc = new Criteria(); QueryByCriteria q; Collection result; // get all mails for contact 123 Integer id = new Integer(123); to.addEqualTo(toList.id, id); cc.addEqualTo(ccList.id, id); bcc.addEqualTo(bccList.id, id); to.addOrCriteria(cc); to.addOrCriteria(bcc); q = QueryFactory.newQuery(Mail.class, to, true); result = broker.getCollectionByQuery(q); i havn't tried it, but i think it should work ;) btw. the field-descriptor no longer needs an id (as you still use in contact) jakob dennis bekkering wrote: Jakob, Thank you for your reacttion. The Contact descriptor = class-descriptor class=nl.salesmakers.model.Contact table=Contact field-descriptor id=30 name=dateOfBirth column=dateofbirth jdbc-type=DATE/ field-descriptor id=31 name=email column=email jdbc-type=VARCHAR/ field-descriptor id=32 name=gender column=gender jdbc-type=VARCHAR/ field-descriptor id=33 name=mobilePhone column=mobilephone jdbc-type=VARCHAR/ field-descriptor id=34 name=firstName column=firstname jdbc-type=VARCHAR/ field-descriptor id=35 name=title column=title jdbc-type=VARCHAR/ field-descriptor id=35 name=type column=type jdbc-type=VARCHAR/ field-descriptor id=36 name=companyId column=companyid jdbc-type=INTEGER/ field-descriptor id=37 name=function column=function jdbc-type=VARCHAR/ field-descriptor id=39 name=middleName column=middlename jdbc-type=VARCHAR/ field-descriptor id=40 name=initials column=initials jdbc-type=VARCHAR/ field-descriptor id=41 name=phone column=phone jdbc-type=VARCHAR/ field-descriptor id=42 name=id column=id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor id=43 name=lastName column=lastname jdbc-type=VARCHAR/ field-descriptor id=44 name=creationDate column=creationdate jdbc-type=DATE/ field-descriptor id=45 name=searchName column=searchname jdbc-type=VARCHAR/ field-descriptor id=46 name=privat column=privat jdbc-type=VARCHAR/ field-descriptor id=47 name=userId column=userid jdbc-type=INTEGER/ field-descriptor id=48 name=mailFooter column=mailfooter jdbc-type=VARCHAR/ field-descriptor id=49 name=mailHeader column=mailheader jdbc-type=VARCHAR/ reference-descriptor name=user class-ref=nl.salesmakers.model.User foreignkey field-ref=userId/ /reference-descriptor reference-descriptor name=company class-ref=nl.salesmakers.model.Company foreignkey field-ref=companyId/ /reference-descriptor field-descriptor name=online column=online jdbc-type=INTEGER/ /class-descriptor Dennis - Original Message - From: Jakob Braeuchi [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, June 09, 2004 9:39 PM Subject: Re: joining hi dennis, how does the classdescriptor for Contact look ? jakob dennis bekkering wrote: Hello, I have class Mail with some collections that return contacts. public class Mail { private Collection attachementList = new ArrayList(); private Collection bccList = new ArrayList(); private Collection ccList = new ArrayList(); private Collection toList = new ArrayList(); } descriptor : collection-descriptor name=toList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailTo2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=ccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailCc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=bccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailBcc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor My sql query for getting all mail messages send to a certain contact : SELECT distinct m.* + FROM + Mail m , + Contact c , + MailTo2Contact mtc , + MailCc2Contact mcc , + MailBcc2Contact mbc + WHERE + (( m.id = mtc.mailid + AND + c.id = mtc.contactid ) + OR + (m.id = mcc.mailid + AND + c.id = mcc.contactid ) + OR + (m.id = mbc.mailid + AND + mbc.contactid = c.id )) + AND + c.id = + contact.getId() + AND + m.flag = 'sent' + order by m.date desc+ ; I offcourse would like to use the pb API but dont know how. Any hints? I cannot use select in , since mysql 4.0 does not support them and 4.1 is not in production. regards, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: joining
Jakob, Thank you for your reacttion. The Contact descriptor = class-descriptor class=nl.salesmakers.model.Contact table=Contact field-descriptor id=30 name=dateOfBirth column=dateofbirth jdbc-type=DATE/ field-descriptor id=31 name=email column=email jdbc-type=VARCHAR/ field-descriptor id=32 name=gender column=gender jdbc-type=VARCHAR/ field-descriptor id=33 name=mobilePhone column=mobilephone jdbc-type=VARCHAR/ field-descriptor id=34 name=firstName column=firstname jdbc-type=VARCHAR/ field-descriptor id=35 name=title column=title jdbc-type=VARCHAR/ field-descriptor id=35 name=type column=type jdbc-type=VARCHAR/ field-descriptor id=36 name=companyId column=companyid jdbc-type=INTEGER/ field-descriptor id=37 name=function column=function jdbc-type=VARCHAR/ field-descriptor id=39 name=middleName column=middlename jdbc-type=VARCHAR/ field-descriptor id=40 name=initials column=initials jdbc-type=VARCHAR/ field-descriptor id=41 name=phone column=phone jdbc-type=VARCHAR/ field-descriptor id=42 name=id column=id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor id=43 name=lastName column=lastname jdbc-type=VARCHAR/ field-descriptor id=44 name=creationDate column=creationdate jdbc-type=DATE/ field-descriptor id=45 name=searchName column=searchname jdbc-type=VARCHAR/ field-descriptor id=46 name=privat column=privat jdbc-type=VARCHAR/ field-descriptor id=47 name=userId column=userid jdbc-type=INTEGER/ field-descriptor id=48 name=mailFooter column=mailfooter jdbc-type=VARCHAR/ field-descriptor id=49 name=mailHeader column=mailheader jdbc-type=VARCHAR/ reference-descriptor name=user class-ref=nl.salesmakers.model.User foreignkey field-ref=userId/ /reference-descriptor reference-descriptor name=company class-ref=nl.salesmakers.model.Company foreignkey field-ref=companyId/ /reference-descriptor field-descriptor name=online column=online jdbc-type=INTEGER/ /class-descriptor Dennis - Original Message - From: Jakob Braeuchi [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, June 09, 2004 9:39 PM Subject: Re: joining hi dennis, how does the classdescriptor for Contact look ? jakob dennis bekkering wrote: Hello, I have class Mail with some collections that return contacts. public class Mail { private Collection attachementList = new ArrayList(); private Collection bccList = new ArrayList(); private Collection ccList = new ArrayList(); private Collection toList = new ArrayList(); } descriptor : collection-descriptor name=toList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailTo2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=ccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailCc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=bccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailBcc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor My sql query for getting all mail messages send to a certain contact : SELECT distinct m.* + FROM + Mail m , + Contact c , + MailTo2Contact mtc , + MailCc2Contact mcc , + MailBcc2Contact mbc + WHERE + (( m.id = mtc.mailid + AND + c.id = mtc.contactid ) + OR + (m.id = mcc.mailid + AND + c.id = mcc.contactid ) + OR + (m.id = mbc.mailid + AND + mbc.contactid = c.id )) + AND + c.id = + contact.getId() + AND + m.flag = 'sent' + order by m.date desc+ ; I offcourse would like to use the pb API but dont know how. Any hints? I cannot use select in , since mysql 4.0 does not support them and 4.1 is not in production. regards, Dennis - 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]
Mapping a join using collection-descriptor, not joining on primary key
Hello. I'm currently trying to make a join between two tables using a collection-descriptor. Here's the story : I've got a table listing units, with a primary key consisting of a unit ID. Each unit can have a manager, and a correspondant : those are two 0:1 relations (you can have one or none in each case). So the units table has got two columns each containing an ID which points to the persons table. Here is the SQL request I'd issue : SELECT * FROM UNITS U LEFT OUTER JOIN PERSONS P1 ON U.MNG_ID = P1.PID LEFT OUTER JOIN PERSONS P1 ON U.CORR_ID = P2.PID; For the moment, I have tried with a reference descriptor, on one column only : reference-descriptor name=manager class-ref=mypkg.Manager auto-retrieve=true foreignkey field-id-ref=2 / /reference-descriptor The second field is MNG_ID. The only problem is that, using P6Spy, I noticed that each time I called the returned Iterator's next() method, OJB would issue a call to the database to retrieve the data from the PERSONS table, which certainly isn't what I want : I want the whole data to be retrieved in one SQL call, period. So I glanced into the documentation, to see the allArticlesInGroup example. But this isn't quite what I want : I'd like to be able to specify that I want MNG_ID to be used for the join, not USERS' primary key. And since the collection-descriptor should be on the USERS table and it doesn't permit to specify a foreign-key, I don't know how I can do it. Can I achieve this and have OJB get the job done in one SQL call ? Thanks. Patrick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]