Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 29322 invoked from network); 11 Jun 2005 10:34:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Jun 2005 10:34:06 -0000 Received: (qmail 9732 invoked by uid 500); 11 Jun 2005 10:34:02 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 9707 invoked by uid 500); 11 Jun 2005 10:34:01 -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 9692 invoked by uid 99); 11 Jun 2005 10:34:01 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from etumbx.unige.ch (HELO etumbx.unige.ch) (129.194.9.235) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 11 Jun 2005 03:33:58 -0700 Received: from conversion-daemon.etumbx.unige.ch by etumbx.unige.ch (Sun Java System Messaging Server 6.1 HotFix 0.11 (built Jan 28 2005)) id <0IHW00A01WFBU100@etumbx.unige.ch> (original mail from thomas0@etu.unige.ch) for ojb-user@db.apache.org; Sat, 11 Jun 2005 12:33:37 +0200 (CEST) Received: from localhost (etuweb2.unige.ch [129.194.9.238]) by etumbx.unige.ch (Sun Java System Messaging Server 6.1 HotFix 0.11 (built Jan 28 2005)) with ESMTP id <0IHX004IC1BZ8M10@etumbx.unige.ch> for ojb-user@db.apache.org; Sat, 11 Jun 2005 12:33:35 +0200 (CEST) Received: from 85.232.166.6 ([85.232.166.6]) by www.etu.unige.ch (IMP) with HTTP for ; Sat, 11 Jun 2005 12:33:35 +0200 Date: Sat, 11 Jun 2005 12:33:35 +0200 From: thomas0@etu.unige.ch Subject: Re: Oracle exception: column ambiguously defined - need help To: ojb-user@db.apache.org Message-id: <1118486015.42aabdffbf53b@www.etu.unige.ch> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Comment: This message was scanned against viruses by etumbx.unige.ch. User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Thanks for correcting my wrong use of criterias. Unfortunately this doesn't solve my problem. Let me explain my situation with more details. I want to model a filesystem with java classes. First there's the Element class. Then there's the Fichier (File in french) class and the Folder class who inherits from Element. I want the Folder class to have a collection of Fichiers and a collection of Folders to represent the Elements contained in each folder. I want also to do a cross-link by having a collection in the Element class to represent the list of containers for an Element. Here's an image of the structure: http://www.ashtom.net/img/objectLayerStructure.gif Here's a representation of the database structure: http://www.ashtom.net/img/database_model.gif Here's the repository who fits at best with what I want to represent with my model: http://www.ashtom.net/files/not_working_repository.xml Unfortunately, this repository raises an Oracle exception (ORA-00918: column ambiguously defined). On the second hand, this configuration below works but it doesn't allow to my application to differentiate a Folder from a Fichier: http://www.ashtom.net/files/working_repository.xml I know this is a lot of trouble but I really don't know how to solve this problem. Thanks a lot for your help ! Alexandre ----- Original Message ----- From: "Jakob Braeuchi" To: "OJB Users List" Sent: Friday, June 10, 2005 6:18 PM Subject: Re: Oracle exception: column ambiguously defined - need help > 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