Re: [OJB-developers] n:m-Mapping with Extent
Brought to you by:
thma
From: <Joa...@tp...> - 2002-04-30 07:48:29
|
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= ? ) AND oneside_manyside.manyside_id=manyside.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= ? ) AND > oneside_manyside.manyside_id=manyside.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 > |