Thread: [OJB-developers] SQLGenerator
Brought to you by:
thma
From: Oleg N. <on...@uk...> - 2002-05-02 14:32:10
|
Hi, I started to work on the "OQL Self Joins" issue http://sourceforge.net/forum/forum.php?thread_id=655922&forum_id=43066 so I am looking at the SQLGenerator stuff, and its capabilities seem a bit restricted. Please, confirm the following statements 1) OJB supports only databases that support SQL-92 JOIN syntax (INNER JOIN, LEFT OUTER JOIN). Thus Sybase ASE and MS SQL Server aren't supported, since they don't support SQL-92 JOIN syntax AFAIK. Does Oracle support it? Not sure. I suppose that generating of join syntax should be delegated to Platform implementations. 2) OJB doesn't support queries on columns with path longer than 1, i.e. it successfully handles crit.addEqualTo("source.name", "A"); but fails on crit.addGreaterThan("source.location.x", new Integer(0)); I can try to solve these issues too. Regards, Oleg |
From: Henri Y. <ba...@ge...> - 2002-05-02 14:36:46
|
I'm not much of a DB guy, but I am pretty sure we're using the SQL-92 JOIN syntax in Oracle 9i. I think 8 and before, maybe 8i didn't support that. On Thu, 2 May 2002, Oleg Nitz wrote: > Hi, > > I started to work on the "OQL Self Joins" issue > http://sourceforge.net/forum/forum.php?thread_id=655922&forum_id=43066 > so I am looking at the SQLGenerator stuff, and its capabilities seem a bit > restricted. Please, confirm the following statements > 1) OJB supports only databases that support SQL-92 JOIN syntax (INNER JOIN, > LEFT OUTER JOIN). > Thus Sybase ASE and MS SQL Server aren't supported, since they don't support > SQL-92 JOIN syntax AFAIK. Does Oracle support it? Not sure. > I suppose that generating of join syntax should be delegated to Platform > implementations. |
From: Oleg N. <on...@uk...> - 2002-05-02 17:21:22
|
On Thursday 02 May 2002 17:36, you wrote: >=9AI'm not much of a DB guy, but I am pretty sure we're using the SQL-92= JOIN >=9Asyntax in Oracle 9i. I think 8 and before, maybe 8i didn't support th= at. Thank you for the info. I also think that Oracle 8i doesn't support that. Thanks, =9AOleg |
From: bram <br...@in...> - 2002-05-02 19:21:39
|
Examples Tables: A(id int, name varchar(10)) B(id int, value varchar(10)) Records A 1, "name1" 2, "name2" Records B 1, "value1" Sql92: Works with Mssql70, Mssql2000, postgresql, oracle 9(not checked, but dba-er says it works) Select a.name, b.value From a left outer join b on (a.id = b.id) Result: Name1, value1 Name2, null Ms sqlserver 6.5/7.0/2000 syntax Select a.name, b.value From a , b where a.id *= b.id Result: Name1, value1 Name2, null Oracle 8 Select a.name, b.value From a , b where a.id = b.id (+) Result: Name1, value1 Name2, null |
From: Oleg N. <on...@uk...> - 2002-05-02 21:25:51
|
Thanks Bram! Oleg On Thursday 02 May 2002 22:21, you wrote: > Examples > > Tables: > A(id int, name varchar(10)) > B(id int, value varchar(10)) > > Records A > 1, "name1" > 2, "name2" > > Records B > 1, "value1" > > > > > Sql92: > Works with Mssql70, Mssql2000, postgresql, oracle 9(not checked, but > dba-er says it works) > > Select a.name, b.value > From a left outer join b on (a.id = b.id) > > Result: > Name1, value1 > Name2, null > > Ms sqlserver 6.5/7.0/2000 syntax > > Select a.name, b.value > From a , b > where a.id *= b.id > > Result: > Name1, value1 > Name2, null > > > Oracle 8 > Select a.name, b.value > From a , b > where a.id = b.id (+) > > Result: > Name1, value1 > Name2, null |
From: Jakob B. <jbr...@ho...> - 2002-05-03 07:29:17
|
hi oleg, i did the original path expression to build joins and so i'm responsible for all it's limitations ;-) one issue is the type of the join (LEFT, RIGHT etc.). today selection criteria and report queries provides no way to define join-type. we could define it in the path: - konti+.saldo (OUTER) or in the criteria - crit.addGreaterThan("konti.saldo", new Integer(100), OUTER); do you have other ideas ? jakob ----- Original Message ----- From: "Oleg Nitz" <on...@uk...> To: <obj...@li...> Sent: Thursday, May 02, 2002 11:29 PM Subject: Re: [OJB-developers] SQLGenerator > Thanks Bram! > > Oleg > > On Thursday 02 May 2002 22:21, you wrote: > > Examples > > > > Tables: > > A(id int, name varchar(10)) > > B(id int, value varchar(10)) > > > > Records A > > 1, "name1" > > 2, "name2" > > > > Records B > > 1, "value1" > > > > > > > > > > Sql92: > > Works with Mssql70, Mssql2000, postgresql, oracle 9(not checked, but > > dba-er says it works) > > > > Select a.name, b.value > > From a left outer join b on (a.id = b.id) > > > > Result: > > Name1, value1 > > Name2, null > > > > Ms sqlserver 6.5/7.0/2000 syntax > > > > Select a.name, b.value > > From a , b > > where a.id *= b.id > > > > Result: > > Name1, value1 > > Name2, null > > > > > > Oracle 8 > > Select a.name, b.value > > From a , b > > where a.id = b.id (+) > > > > Result: > > Name1, value1 > > Name2, null > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |
From: Oleg N. <on...@uk...> - 2002-05-03 22:15:30
|
On Friday 03 May 2002 10:29, Jakob Braeuchi wrote: > hi oleg, > > i did the original path expression to build joins and so i'm responsible > for all it's limitations ;-) I'm glad to meet a responsible person ;-) > one issue is the type of the join (LEFT, RIGHT etc.). > today selection criteria and report queries provides no way to define > join-type. > we could define it in the path: > > - konti+.saldo (OUTER) or in the criteria > - crit.addGreaterThan("konti.saldo", new Integer(100), OUTER); > > do you have other ideas ? I suppose that in the case of query condition we should always use inner join. IMHO if one say "saldo > 100" he wouldn't expect to get saldo == null. Well, in the case of "saldo < 100" it makes more sense :) I don't know if anyone really need outer joins here. I don't need them. Outer joins may become useful in some other cases, IMHO they should be supported by SQLGenerator. Anyway INNER JOIN syntax is RDBMS dependent. Regards, Oleg |
From: bram <br...@in...> - 2002-05-03 22:46:56
|
IMHO if one say "saldo > 100" he wouldn't expect to get saldo == null. Well, in the case of "saldo < 100" it makes more sense :) I don't agree with the second statement, null is not known, so you can't compare it with a value, it is smaller, bigger and equal to 100, all in once, you just don't know :-) |
From: Oleg N. <on...@uk...> - 2002-05-04 07:58:38
|
On Saturday 04 May 2002 01:46, bram wrote: > IMHO if one say "saldo > 100" he wouldn't expect to get saldo == null. > > > Well, in the case of "saldo < 100" it makes more sense :) > > I don't agree with the second statement, null is not known, so you can't > compare it with a value, it is smaller, bigger and equal to 100, all in > once, you just don't know :-) Of course you are right, I was kidding :) Oleg |
From: Jakob B. <jbr...@ho...> - 2002-05-04 08:37:42
|
hi oleg, you know, in switzerland the responsible persons get the real huge salaries, even if they do a bad job ;-) SQLGenerator has no function to automatically detect an OUTER join. But JoinInfo innerclass could generate the appropriate SQL. So we need a way to explicitely use OUTER joins and i prefer to define it in the criteria. regards jakob ----- Original Message ----- From: "Oleg Nitz" <on...@uk...> To: <obj...@li...> Sent: Friday, May 03, 2002 11:53 PM Subject: Re: [OJB-developers] SQLGenerator > On Friday 03 May 2002 10:29, Jakob Braeuchi wrote: > > hi oleg, > > > > i did the original path expression to build joins and so i'm responsible > > for all it's limitations ;-) > I'm glad to meet a responsible person ;-) > > > one issue is the type of the join (LEFT, RIGHT etc.). > > today selection criteria and report queries provides no way to define > > join-type. > > we could define it in the path: > > > > - konti+.saldo (OUTER) or in the criteria > > - crit.addGreaterThan("konti.saldo", new Integer(100), OUTER); > > > > do you have other ideas ? > I suppose that in the case of query condition we should always use inner join. > IMHO if one say "saldo > 100" he wouldn't expect to get saldo == null. > Well, in the case of "saldo < 100" it makes more sense :) > I don't know if anyone really need outer joins here. I don't need them. > Outer joins may become useful in some other cases, IMHO they should be > supported by SQLGenerator. > Anyway INNER JOIN syntax is RDBMS dependent. > > Regards, > Oleg > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |
From: Chris G. <CGr...@de...> - 2002-05-05 03:18:33
|
I have a question about unit testing for ObjectBridge. As it stands, the test files are segregated by (1) location and (2) packaging from the production files. The location is understandable, although having ant as a build tool really makes it unnecessary. But the packaging -- having a "test." package prefix for tests -- makes it impossible to test protected methods. If your protected methods happen to be in a base class with several descendants that use those methods frequently, I feel that it's critical to test the methods. But if they're methods that shouldn't be used anywhere outside the base class or its children, then there is no good design reason to make them public -- in fact it really clutters up the public interface of the class. So what is the approach people have taken in the past? Is there a good reason for me not to test protected methods? Is there a compelling reason to put test classes in a different package? As it is, I'll leave out the unit tests I have that test protected methods for the moment. I'd like to commit them, though. Regards, Chris Greenlee |
From: Chris G. <CGr...@de...> - 2002-05-05 18:25:55
|
Using a fresh checkout of OJB from before the commits I've done in the last 24 hours, I get 4 failures when running "ant junit". They're all in MtoNMapping.java. Is anyone else seeing this, or should I monkey around with my local SQL Server? Cheers, Chris |
From: Oleg N. <on...@uk...> - 2002-05-05 19:09:00
|
On Sunday 05 May 2002 21:25, Chris Greenlee wrote: > Using a fresh checkout of OJB from before the commits I've done in the last > 24 hours, I get 4 failures when running "ant junit". They're all in > MtoNMapping.java. Is anyone else seeing this, or should I monkey around > with my local SQL Server? I see 1 failure: [junit] 1) testInsertion(test.ojb.broker.MtoNMapping)junit.framework.AssertionFailedError: expected:<3> but was:<2> [junit] at test.ojb.broker.MtoNMapping.testInsertion(MtoNMapping.java:165) Oleg |
From: Jakob B. <jbr...@ho...> - 2002-05-06 06:34:26
|
hi oleg, chris, i only see the one failure testInsertion(test.ojb.broker.MtoNMapping)junit.framework.AssertionFailedErr or: expected:<3> but was:<2> jakob ----- Original Message ----- From: "Oleg Nitz" <on...@uk...> To: <obj...@li...> Sent: Sunday, May 05, 2002 9:12 PM Subject: Re: [OJB-developers] Failing unit tests > On Sunday 05 May 2002 21:25, Chris Greenlee wrote: > > Using a fresh checkout of OJB from before the commits I've done in the last > > 24 hours, I get 4 failures when running "ant junit". They're all in > > MtoNMapping.java. Is anyone else seeing this, or should I monkey around > > with my local SQL Server? > I see 1 failure: > [junit] 1) > testInsertion(test.ojb.broker.MtoNMapping)junit.framework.AssertionFailedErr or: > expected:<3> but was:<2> > [junit] at > test.ojb.broker.MtoNMapping.testInsertion(MtoNMapping.java:165) > > Oleg > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |
From: Jakob B. <jbr...@ho...> - 2002-05-06 06:49:45
|
hi chris, afaik the method storeMtoNImplementor of PersitenceBrokerImpl only stores data in the relation table but not in the project table, so the new project is not inserted. didn't you make changes in this area ? jakob ----- Original Message ----- From: "Jakob Braeuchi" <jbr...@ho...> To: "Oleg Nitz" <on...@uk...>; <obj...@li...> Sent: Monday, May 06, 2002 8:34 AM Subject: Re: [OJB-developers] Failing unit tests > hi oleg, chris, > > i only see the one failure > testInsertion(test.ojb.broker.MtoNMapping)junit.framework.AssertionFailedErr > or: expected:<3> but was:<2> > > jakob > > > ----- Original Message ----- > From: "Oleg Nitz" <on...@uk...> > To: <obj...@li...> > Sent: Sunday, May 05, 2002 9:12 PM > Subject: Re: [OJB-developers] Failing unit tests > > > > On Sunday 05 May 2002 21:25, Chris Greenlee wrote: > > > Using a fresh checkout of OJB from before the commits I've done in the > last > > > 24 hours, I get 4 failures when running "ant junit". They're all in > > > MtoNMapping.java. Is anyone else seeing this, or should I monkey around > > > with my local SQL Server? > > I see 1 failure: > > [junit] 1) > > > testInsertion(test.ojb.broker.MtoNMapping)junit.framework.AssertionFailedErr > or: > > expected:<3> but was:<2> > > [junit] at > > test.ojb.broker.MtoNMapping.testInsertion(MtoNMapping.java:165) > > > > Oleg > > > > _______________________________________________________________ > > > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > > the hardware. You get the recognition. Email Us: ban...@so... > > _______________________________________________ > > Objectbridge-developers mailing list > > Obj...@li... > > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |
From: Thomas M. <tho...@ho...> - 2002-05-12 15:38:29
|
Hi Chris, Chris Greenlee wrote: > I have a question about unit testing for ObjectBridge. > > As it stands, the test files are segregated by (1) location and (2) > packaging from the production files. The location is understandable, > although having ant as a build tool really makes it unnecessary. But the > packaging -- having a "test." package prefix for tests -- makes it > impossible to test protected methods. > In the "early days" we were completely happy with black-box tests against public interfaces only. I know that the Unit testing folks say it's best practise to have a unit test even for getters and setters... > If your protected methods happen to be in a base class with several > descendants that use those methods frequently, I feel that it's critical to > test the methods. But if they're methods that shouldn't be used anywhere > outside the base class or its children, then there is no good design reason > to make them public -- in fact it really clutters up the public interface of > the class. > > So what is the approach people have taken in the past? Is there a good > reason for me not to test protected methods? Is there a compelling reason > to put test classes in a different package? > I started to develop OJB with VisualAge for Java. With VAJ it was not possible to have different physical locations for the same package structure. That's why I was urged to use a "test." prefix to avoid mixing test and production code. Of course this is not a compelling reason now, as VAJ is dead and modern tools can handle split-up classpaths well. So imho it's ok to eleminate the "test." prefix now! AFAIK the build tool MAVEN requires to separate the physical location for test and production code as Martin setup subfolders "src/java" and "src/test". > As it is, I'll leave out the unit tests I have that test protected methods > for the moment. I'd like to commit them, though. > feel free to rename the package names of the test cases! cheers, Thomas > Regards, > > Chris Greenlee > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > > |
From: Jakob B. <jbr...@ho...> - 2002-05-03 11:36:12
|
hi oleg, i've now fixed multi segment path expressions ie: owner.phone.number = ? jakob |
From: Oleg N. <on...@uk...> - 2002-05-03 21:50:37
|
On Friday 03 May 2002 14:36, Jakob Braeuchi wrote: > hi oleg, > > i've now fixed multi segment path expressions ie: owner.phone.number = ? Great! BTW, are you going to do more modifications SQLGenerator? Thanks, Oleg |
From: Jakob B. <jbr...@ho...> - 2002-05-04 08:30:01
|
hi oleg, i'll only do minor bufixes in SQLGenerator, except the platform dependent join clause. jakob ----- Original Message ----- From: "Oleg Nitz" <on...@uk...> To: <obj...@li...> Sent: Friday, May 03, 2002 11:54 PM Subject: Re: [OJB-developers] SQLGenerator > On Friday 03 May 2002 14:36, Jakob Braeuchi wrote: > > hi oleg, > > > > i've now fixed multi segment path expressions ie: owner.phone.number = ? > Great! > BTW, are you going to do more modifications SQLGenerator? > > Thanks, > Oleg > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |