Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 16408 invoked from network); 10 Jun 2005 16:19:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jun 2005 16:19:46 -0000 Received: (qmail 30183 invoked by uid 500); 10 Jun 2005 16:19:42 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 30143 invoked by uid 500); 10 Jun 2005 16:19:41 -0000 Mailing-List: contact ojb-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "OJB Users List" Reply-To: "OJB Users List" Delivered-To: mailing list ojb-user@db.apache.org Received: (qmail 30121 invoked by uid 99); 10 Jun 2005 16:19:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of jbraeuchi@gmx.ch designates 213.165.64.20 as permitted sender) Received: from pop.gmx.de (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 10 Jun 2005 09:19:39 -0700 Received: (qmail invoked by alias); 10 Jun 2005 16:18:41 -0000 Received: from unknown (EHLO [192.168.1.10]) [194.230.113.228] by mail.gmx.net (mp007) with SMTP; 10 Jun 2005 18:18:41 +0200 X-Authenticated: #15507884 Message-ID: <42A9BD5E.3010101@gmx.ch> Date: Fri, 10 Jun 2005 18:18:38 +0200 From: Jakob Braeuchi User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: OJB Users List Subject: Re: Oracle exception: column ambiguously defined - need help References: <1118352561.42a8b4b17040c@www.etu.unige.ch> In-Reply-To: <1118352561.42a8b4b17040c@www.etu.unige.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N hi thomas, if the attribute is named 'InRoot' then you should use this name in the query and not the name of the column ! jakob thomas0@etu.unige.ch schrieb: > Thanks for answering me, > > The two m:n relations from are here because I wanted my application (a JSF > application) to differentiate a "matis.component.filemanager.Fichier" from a > "matis.component.filemanager.Folder", so I can use methods specific to each > class. > For the query part, there's actually a "InRoot" attribute (a boolean) described > in my repository in the > "matis.component.filemanager.Element" (which is the parent class of Fichier and > Folder) class descriptor. > > extract of Element class descriptor: > > name="InRoot" > column="INROOT" > jdbc-type="INTEGER" > > conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"/> > > How could I build a query with this attribute (as it is a boolean I don't know > how to compare InRoot with a boolean). > > Thanks again for your help, > > Alexandre > > > ----- Original Message ----- > From: "Jakob Braeuchi" > To: "OJB Users List" > Sent: Wednesday, June 08, 2005 6:56 PM > Subject: Re: Oracle exception: column ambiguously defined - need help > > > >>hi alexandre, >> >>the mapping looks a little strange to me. From Folder you have two m:n >>relationships pointing to different classes, but both use the same >>indirection table. another thing is the attribute 'INROOT' in the >>criteria. there's no such attribute defined in the class-descriptor of >>class 'Folder'. the attributes used in a query are usually attributesof >>the class not columns. >> >>jakob >> >>thomas0@etu.unige.ch schrieb: >> >>>Hello, >>> >>>My name is Alexandre and I'm a student in the University of Geneva in the >>>Information Systems departement. >>> >>>I'm currently working on a web application using an OJB layer. I have a >>>problem of column ambiguously defined when querying my Oracle Database > > through > >>>OJB's QueryFactory method. I read Jakob Braeuchi's answer to Naveen > > regarding > >>>column prefixes. >>>Unfortunately, I didn't quite understand his solution: how can I base > > columns > >>>on >>>attributes? >>> >>>here is the method querying the database: >>> >>>PersistenceBroker broker = >>>PersistenceBrokerFactory.defaultPersistenceBroker(); >>> Collection rootelements = null; >>> Criteria crit = new Criteria(); >>> crit.addEqualTo("INROOT","1"); >>> Query q = QueryFactory.newQuery(Folder.class, crit); >>> try{ >>> rootelements = broker.getCollectionByQuery(q); >>> } >>> catch(PersistenceBrokerException e) >>> { >>> e.printStackTrace(); >>> if(broker != null) broker.abortTransaction(); >>> } >>> finally >>> { >>> if (broker != null) broker.close(); >>> } >>> >>>And here is the part of the relevant repository: >>> >>> >> schema="FM" >>> class="matis.component.filemanager.Folder" >>> table="FOLDER"> >>> >>> >> name="id_Elem" >>> column="ID_FOLDER" >>> jdbc-type="INTEGER" >>> primarykey="true"/> >>> >>> >> name="fichiersContained" >>> > > collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList" > >>> element-class-ref="matis.component.filemanager.Fichier" >>> auto-retrieve="true" >>> auto-update="true" >>> auto-delete="true" >>> indirection-table="INFOLD"> >>> >>> >>> >>> >>> >> name="foldersContained" >>> > > collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList" > >>> element-class-ref="matis.component.filemanager.Folder" >>> auto-retrieve="true" >>> auto-update="true" >>> auto-delete="true" >>> indirection-table="INFOLD"> >>> >>> >>> >>> >>> >> class-ref="matis.component.filemanager.Element" >>> auto-retrieve="true" >>> auto-update="true" >>> auto-delete="true"> >>> >>> >>> >>> >>> >>>When logging OJB's activity, I can see the query who raises the Oracle >>>exception (ORA-00918: column ambiguously defined), here it is: >>> >>>SELECT A0.ID_FOLDER >>>FROM FM.FOLDER A0,INFOLD,FM.element A1,INFOLD >>>WHERE A0.ID_FOLDER=A1.ID_ELEMENT >>>AND ((INFOLD.FOL_ID_ELEMENT IN (?,?,?)) >>>AND A0.ID_FOLDER = INFOLD.ID_ELEMENT) >>> >>>I'm a bit lost since it's my first time using OJB (I hope it's not the >>>last). >>> >>>Thanks a lot for reading my request and thanks in advance for your help. >>> >>>Yours Sincerely, >>> >>>Alexandre Thomas > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-user-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org