You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by casterx <ca...@netzero.net> on 2003/05/20 17:48:30 UTC
OJB 1.0rc3 and OUTER joins
After reading the new documentation, I recall that OJB started to support
right outer joins on simple 1:1 relationships. I tried to run a simple
program, but so far have no luck getting the outer joins to work. OJB
doesn't provide them by default, nor do I see them when I add
query.setPathOuterJoin("countryLookup") on the reference object.
Any ideas? Today, after re-reading the documentation, that information seems
to have disappeared. Was this feature recently removed?
Any help on reducing the number of 1:1 queries would be greatly appreciated
Thanks
Caster
Re: How to put OJB to an application?
Posted by Leon <le...@hotmail.com>.
Sorry, It looks like the OjbPbFactory should be created by myself, right?
Leon
----- Original Message -----
From: "Leon" <le...@hotmail.com>
To: "OJB Users List" <oj...@db.apache.org>; <th...@apache.org>
Sent: Wednesday, May 21, 2003 10:46 AM
Subject: Re: How to put OJB to an application?
> It is greate helpful and thank you all.
> When I wrote OjbPbStartup class, I could not find OjbPbFactory class.
Could
> you help me out?
>
> Leon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
Re: How to put OJB to an application?
Posted by Leon <le...@hotmail.com>.
It is greate helpful and thank you all.
When I wrote OjbPbStartup class, I could not find OjbPbFactory class. Could
you help me out?
Leon
Re: How to put OJB to an application?
Posted by Thomas Mahler <th...@web.de>.
Hi Leon,
There is a good book on struts + OJB by Chuck Cavaness:
http://safari.oreilly.com/?XmlId=0-596-00328-5
Chuck also provided us with a sample app integrating struts and ojb:
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/contrib/struts-ojb.zip?rev=HEAD
Here is another presentation by Chuck covering OJB:
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/contrib/cavaness-ajug-slides.pdf?rev=HEAD
There is antother struts/ojb howto at:
http://www.robertoghizzioli.it/jcomm/jcomm_tutorial.html
Deploying OJB to Weblogic is covered here:
http://db.apache.org/ojb/deployment.html
There are also lots of deployment discussions in the mailinglist archives.
here are all kinds of interesting links for OJB users:
http://db.apache.org/ojb/links.html
hope this gets you started,
Thomas
Leon wrote:
> Hello,
>
> I am newbie of OJB. I want to use the OJB as the persistance framework in
> our project with Struts and Weblogic. Could anyone give me some idear to put
> OJB, Struts and Weblogic together?
> Thanks in advance.
>
> Leon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
Re: How to put OJB to an application?
Posted by Brian McCallister <mc...@forthillcompany.com>.
A good example of Stuts + OJB is the OJB + Struts is the OJB Beer4All at
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/contrib/struts-
ojb.zip?rev=HEAD
It doesn't use Weblogic, but in this case that is just a servlet
container (no CMP configuration etc) so deploy a servlet however you
would deploy a servlet in Weblogic (I have never had the
misfor^H^H^H^H^H^H opportunity to use that particular container).
I have used them together for a couple of applications and it is quite
painless. Of course Struts doesn't know there is OJB, and OJB doesn't
know there is Struts... Hmm, and Struts doesn't know there is Velocity,
but Velocity does (unfortunately) have to know about Struts =/
-Brian
On Tuesday, May 20, 2003, at 08:20 PM, Leon wrote:
> Hello,
>
> I am newbie of OJB. I want to use the OJB as the persistance framework
> in
> our project with Struts and Weblogic. Could anyone give me some idear
> to put
> OJB, Struts and Weblogic together?
> Thanks in advance.
>
> Leon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
How to put OJB to an application?
Posted by Leon <le...@hotmail.com>.
Hello,
I am newbie of OJB. I want to use the OJB as the persistance framework in
our project with Struts and Weblogic. Could anyone give me some idear to put
OJB, Struts and Weblogic together?
Thanks in advance.
Leon
Re: OJB 1.0rc3 and OUTER joins
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi caster,
outer joins are for queries only, what you need is prefetched relationships.
hth
jakob
casterx wrote:
>Jakob,
>
>Isn't the idea behind an outer join to reduce the number of queries? It just
>seems inefficient to execute two queries to load information for the same
>class, especially when a large number of records are retrieved?
>
>
>
>
>>hi caster,
>>
>>ah i see, the problem happens when retrieving the reference.
>>this is done with another query not the one you added the outer join.
>>the query used to load the reference can be tweaked with a query
>>
>>
>customizer.
>
>
>>but actually i do not understand why you want to use an outer for this
>>kind of query ??
>>afaik it could be useful when selecting suppliers with a given supplier
>>info criteria:
>>
>>Criteria criteria = new Criteria();
>>
>>criteria.addEqualTo("primarySupplierInformation.nameLine2", "FOO");
>>QueryByCriteria query = QueryFactory.newQuery(Supplier.class, criteria);
>>query.setPathOuterJoin("primarySupplierInformation");
>>broker.getIteratorObjectByQuery(query);
>>
>>
>>hth
>>jakob
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
Re: OJB 1.0rc3 and OUTER joins
Posted by casterx <ca...@netzero.net>.
Jakob,
Isn't the idea behind an outer join to reduce the number of queries? It just
seems inefficient to execute two queries to load information for the same
class, especially when a large number of records are retrieved?
> hi caster,
>
> ah i see, the problem happens when retrieving the reference.
> this is done with another query not the one you added the outer join.
> the query used to load the reference can be tweaked with a query
customizer.
>
> but actually i do not understand why you want to use an outer for this
> kind of query ??
> afaik it could be useful when selecting suppliers with a given supplier
> info criteria:
>
> Criteria criteria = new Criteria();
>
> criteria.addEqualTo("primarySupplierInformation.nameLine2", "FOO");
> QueryByCriteria query = QueryFactory.newQuery(Supplier.class, criteria);
> query.setPathOuterJoin("primarySupplierInformation");
> broker.getIteratorObjectByQuery(query);
>
>
> hth
> jakob
>
Re: OJB 1.0rc3 and OUTER joins
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi caster,
ah i see, the problem happens when retrieving the reference.
this is done with another query not the one you added the outer join.
the query used to load the reference can be tweaked with a query customizer.
but actually i do not understand why you want to use an outer for this
kind of query ??
afaik it could be useful when selecting suppliers with a given supplier
info criteria:
Criteria criteria = new Criteria();
criteria.addEqualTo("primarySupplierInformation.nameLine2", "FOO");
QueryByCriteria query = QueryFactory.newQuery(Supplier.class, criteria);
query.setPathOuterJoin("primarySupplierInformation");
broker.getIteratorObjectByQuery(query);
hth
jakob
casterx wrote:
>Jacob,
>
>Here is the information for the code I'm running:
>
>mapping:
>
><class-descriptor class="com.Supplier" table="SUPPLIER">
>
> <field-descriptor
> name="bestSupplierCodePK"
> column="best_supplier_code"
> jdbc-type="VARCHAR"
> primarykey="true"/>
>
> <field-descriptor
> name="webAddress"
> column="web_address"
> jdbc-type="VARCHAR"/>
>
>
> <reference-descriptor
> name="primarySupplierInformation"
> class-ref="com.PrimarySupplierInformation">
> <foreignkey field-ref="bestSupplierCodePK"/>
> </reference-descriptor>
>
>
>
> </class-descriptor>
>
> <class-descriptor class="com.PrimarySupplierInformation"
>table="supplier_primary_view">
>
> <field-descriptor
> name="bestSupplierCodeFK"
> column="best_supplier_code"
> jdbc-type="VARCHAR"
> primarykey="true"/>
>
> <field-descriptor
> name="name"
> column="name"
> jdbc-type="VARCHAR"/>
>
> <field-descriptor
> name="nameLine2"
> column="name_Line_2"
> jdbc-type="VARCHAR"/>
>
> </class-descriptor>
>
>
>Code:
>
>Criteria criteria = new Criteria();
>
> criteria.addEqualTo("bestSupplierCodePK", "BE10079508");
>
> QueryByCriteria query = QueryFactory.newQuery(Supplier.class, criteria);
>
> query.setPathOuterJoin("primarySupplierInformation");
>
>
> Supplier supplier = (Supplier)broker.getObjectByQuery(query);
>
>p6Output:
>
>SELECT A0.best_supplier_code,A0.web_address FROM SUPPLIER A0 WHERE
>A0.best_supplier_code = 'BE10079508'
>
>SELECT name_Line_2,best_supplier_code,name FROM supplier_primary_view WHERE
>best_supplier_code = 'BE10079508'
>
>
>Thanks
>Caster
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
Re: OJB 1.0rc3 and OUTER joins
Posted by casterx <ca...@netzero.net>.
Jacob,
Here is the information for the code I'm running:
mapping:
<class-descriptor class="com.Supplier" table="SUPPLIER">
<field-descriptor
name="bestSupplierCodePK"
column="best_supplier_code"
jdbc-type="VARCHAR"
primarykey="true"/>
<field-descriptor
name="webAddress"
column="web_address"
jdbc-type="VARCHAR"/>
<reference-descriptor
name="primarySupplierInformation"
class-ref="com.PrimarySupplierInformation">
<foreignkey field-ref="bestSupplierCodePK"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor class="com.PrimarySupplierInformation"
table="supplier_primary_view">
<field-descriptor
name="bestSupplierCodeFK"
column="best_supplier_code"
jdbc-type="VARCHAR"
primarykey="true"/>
<field-descriptor
name="name"
column="name"
jdbc-type="VARCHAR"/>
<field-descriptor
name="nameLine2"
column="name_Line_2"
jdbc-type="VARCHAR"/>
</class-descriptor>
Code:
Criteria criteria = new Criteria();
criteria.addEqualTo("bestSupplierCodePK", "BE10079508");
QueryByCriteria query = QueryFactory.newQuery(Supplier.class, criteria);
query.setPathOuterJoin("primarySupplierInformation");
Supplier supplier = (Supplier)broker.getObjectByQuery(query);
p6Output:
SELECT A0.best_supplier_code,A0.web_address FROM SUPPLIER A0 WHERE
A0.best_supplier_code = 'BE10079508'
SELECT name_Line_2,best_supplier_code,name FROM supplier_primary_view WHERE
best_supplier_code = 'BE10079508'
Thanks
Caster
Re: OJB 1.0rc3 and OUTER joins
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi caster,
afaik outer joins are still there.
could you please provide more information about the query you submit ?
jakob
casterx wrote:
>After reading the new documentation, I recall that OJB started to support
>right outer joins on simple 1:1 relationships. I tried to run a simple
>program, but so far have no luck getting the outer joins to work. OJB
>doesn't provide them by default, nor do I see them when I add
>query.setPathOuterJoin("countryLookup") on the reference object.
>
>Any ideas? Today, after re-reading the documentation, that information seems
>to have disappeared. Was this feature recently removed?
>
>Any help on reducing the number of 1:1 queries would be greatly appreciated
>
>Thanks
>Caster
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>