RE: [OJB-developers] n:m-Mapping with Extent
Brought to you by:
thma
From: Amit G. <ago...@de...> - 2002-05-02 19:34:41
|
Is there a patch available for this bug? This is wreaking major havoc on our project. Amit -----Original Message----- From: Jakob Braeuchi [mailto:jbr...@ho...] Sent: Tuesday, April 30, 2002 11:55 AM To: obj...@li...; Joa...@tp... Subject: Re: [OJB-developers] n:m-Mapping with Extent hi joachim, a clean approach would be to have a method in QueryFactory with a query and a class as parameters. the factory should then return a clone (how deep ?) of the query with all criteria and tables etc. based on the new class. greetings jakob ----- Original Message ----- From: <Joa...@tp...> To: <obj...@li...> Sent: Tuesday, April 30, 2002 9:48 AM Subject: Re: [OJB-developers] n:m-Mapping with Extent > > Hy, > > I've already done what you suggested (rebuild a new query), but it was a > very ugly hack, as I didn't know where to put it and how to do it properly > ( I don't even want to mention were I did it ;-). It broke some other tests > 'though and I decided to do a clean approach, rather then debug this ugly > piece of code that I produced. At least I saw that extents in combination > with MtoN-mappings are possible. Is it possible to provide > QueryByMtoNCriteria with the necessary information to rebuild itself for a > specific extent-class/table? I think that would be somewhat nicer. > > regards > Joachim Sauer > > > > > "Jakob > Braeuchi" An: <obj...@li...>, <Joa...@tp...> > <jbraeuchi@ho Kopie: > tmail.com> Thema: Re: [OJB-developers] n:m-Mapping with Extent > > 30.04.2002 > 09:08 > > > > > > hi joachim, > > as you mentioned the problem is the wrong table in from- and where-clause > coming from prebuilt MtoNQuery. > the second problem is getPreparedSelectStatement() in SqlGenerator: for > MtoNQQueries tables are taken from the query and NOT from > the ClassDescriptor, the query still pointing to the tables of the base > class instead of the extent. the same is true for the EqualToColumnCriteria > in the query. > > i think when using extents there is always a mismatch between the query and > the class descriptor but it only hurts with MtoNQuery. > it may be the best thing to build a new query based on the original one for > the extents and then to execute this query. > what do you think ? > > jakob > > > ----- Original Message ----- > From: <Joa...@tp...> > To: <obj...@li...> > Sent: Monday, April 29, 2002 3:04 PM > Subject: [OJB-developers] n:m-Mapping with Extent > > > > Hy, > > > > it's me again. I've finally hunted down the bug. Let me explain the > > scenario: > > > > I've got a class OneSide. Each object can have one or more ManySide > > objects. This is implemented via a List with coresponding > > CollectionDescriptor using a association-table (non-decomposed > N:M-Mapping > > in OJB-speak). Additionally there is a class named ManySideExtent, that > > extends ManySide and is mapped to another table. > > > > When I enable debugging in SqlGenerator I'll find the following messages > > (after many others) when loading a OneSide object: > > > > [ojb.broker.accesslayer.SqlGenerator] DEBUG: SQL: SELECT > > manyside.id,manyside.value FROM manyside, oneside_manyside WHERE > > (oneside_id=3D ? ) AND oneside_manyside.manyside_id=3Dmanyside.id > > > > this one looks quite correct and gets me the correct results (all > ManySide > > objects that belong to the one OneSide object), but the next one (which > > tries to load the ManySideExtent objects) fails: > > > > [ojb.broker.accesslayer.SqlGenerator] DEBUG: SQL: SELECT > > manyside_extent.id,manyside_extent.value,manyside_extent.another_value > FROM > > manyside, oneside_manyside WHERE (oneside_id=3D ? ) AND > > oneside_manyside.manyside_id=3Dmanyside.id > > > > the problem here obviously is, that the wrong table is used in the > > FROM-clause and the WHERE-clause. These come from the Query object, that > is > > created by the PersistenceBrokerImpl in getMtoNQuery. I think calling > > getMtoNQuery with the ClassDescriptor of ManySideExtent for the second > > query would solve the problem, the problem is, that the query is not > built > > in the function that decides wether we need to query for extents ... > > > > Maybe a correct solution would be somewhere else altogether, but I don't > > know enough about the system to see where. > > > > regards > > Joachim Sauer > > > > > > _______________________________________________ > > Objectbridge-developers mailing list > > Obj...@li... > > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > > > > > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > _______________________________________________ Objectbridge-developers mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-developers |