cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Vrakking <d.vrakk...@tsi-solutions.nl>
Subject Re: Prefetched objects aren't used (2.0.4)
Date Fri, 10 Jul 2009 07:49:30 GMT
It is indeed related to the inheritance. I created a small project  
with just these two classes to make experimenting a lot easier ;-)

Without the subentities (Organisation and Supplier), everything works  
as it should with 2.0.4 and 3.0M6.

With the subentities and 3.0M6, the problem remains only when using a  
disjoint prefetch.

Donald


On 9 jul 2009, at 13:00, Andrus Adamchik wrote:

> Hmm... could be a bug related to inheritance presence. Before we dig
> any further, could you try it with Cayenne 3.0M6 (which should be
> mostly compatible). Is the problem still there?
>
> Andrus
>
>
> On Jul 9, 2009, at 12:23 PM, Donald Vrakking wrote:
>
>> There are to entities Supplier and Organisation. Both have a super
>> entity SppSupplier and SppOrganisation, these are mapped to the
>> tables. The query is done for Supplier(.class) and organisation is
>> prefetched using toSppOrganisation.
>>
>> 	<db-entity name="SPP_SUPPLIER" schema="PRODUCTSUPPLIERUSER">
>> 		...attribs...
>> 		<db-attribute name="ORGANISATION_ID" type="INTEGER" length="22"/>
>> 		<db-attribute name="SUPPLIER_ID" type="INTEGER"
>> isPrimaryKey="true" isMandatory="true" length="22"/>
>> 		<db-key-generator>
>> 			<db-generator-type>ORACLE</db-generator-type>
>> 			<db-generator-name>seq_supplier</db-generator-name>
>> 			<db-key-cache-size>1</db-key-cache-size>
>> 		</db-key-generator>
>> 	</db-entity>
>>
>>
>> 	<db-entity name="SPP_ORGANISATION" schema="PRODUCTSUPPLIERUSER">
>> 		...attribs...
>> 		<db-attribute name="ORGANISATION_ID" type="INTEGER"
>> isPrimaryKey="true" isMandatory="true" length="22"/>
>> 		<db-key-generator>
>> 			<db-generator-type>ORACLE</db-generator-type>
>> 			<db-generator-name>seq_organisation</db-generator-name>
>> 			<db-key-cache-size>1</db-key-cache-size>
>> 		</db-key-generator>
>> 	</db-entity>
>>
>> 	<db-relationship name="toSppOrganisation" source="SPP_SUPPLIER"
>> target="SPP_ORGANISATION" toMany="false">
>> 		<db-attribute-pair source="ORGANISATION_ID"
>> target="ORGANISATION_ID"/>
>> 	</db-relationship>
>>
>>
>> 	<obj-entity name="SppOrganisation"
>> className="com.traserv.persist.productsupplier.SppOrganisation"
>> dbEntityName="SPP_ORGANISATION"
>> superClassName="com.traserv.persist.GenericDataObject">
>> 		...attribs...
>> 		<obj-attribute name="name" type="java.lang.String" db-attribute-
>> path="NAME"/>
>> 	</obj-entity>
>>
>> 	<obj-entity name="Organisation" superEntityName="SppOrganisation"
>> className="com.traserv.model.productsupplier.Organisation">
>> 	</obj-entity>
>>
>>
>> 	<obj-entity name="SppSupplier"
>> className="com.traserv.persist.productsupplier.SppSupplier"
>> dbEntityName="SPP_SUPPLIER"
>> superClassName="com.traserv.persist.GenericDataObject">
>> 		...attribs...
>> 	</obj-entity>
>>
>> 	<obj-entity name="Supplier" superEntityName="SppSupplier"
>> className="com.traserv.model.productsupplier.Supplier">
>> 	</obj-entity>
>>
>> 	<obj-relationship name="toSppOrganisation" source="SppSupplier"
>> target="SppOrganisation" db-relationship-path="toSppOrganisation"/>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 9 jul 2009, at 09:29, Andrus Adamchik wrote:
>>
>>> Very odd. This is as vanilla as it can get... Can you copy-paste the
>>> relevant parts of the DataMap? I.e. Obj and Db entities definitions
>>> for both entities and relationships definitions.
>>>
>>> Andrus
>>>
>>>
>>> On Jul 9, 2009, at 10:20 AM, Donald Vrakking wrote:
>>>> It's an n..1 relation; entity A has a foreign key to the PK of B.
>>>> The "to dep pk" flag is not set.
>>>>
>>>> Donald
>>>>
>>>>
>>>> On 9 jul 2009, at 08:59, Andrus Adamchik wrote:
>>>>
>>>>> Let's look at the details of mapping of this relationship. Is it
>>>>> mapped as 1..1 or 1..N? If it is 1..1, is there a "to dep pk" flag
>>>>> set
>>>>> in one of the directions?
>>>>>
>>>>> Andrus
>>>>>
>>>>>
>>>>> On Jul 8, 2009, at 12:43 PM, Donald Vrakking wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>> I have two objects A and B which have an m:1 relation (it's used
>>>>>> as
>>>>>> a 1:1). I created a SelectQuery to get instances of A and added a
>>>>>> prefetch to B. After executing the query, A only has a toOneFault
>>>>>> for B, so when I access B it will execute another
>>>>>> (relationship)query on the database.
>>>>>>
>>>>>> It doesn't matter if I use a DISJOINT or a JOINT prefetch, the
>>>>>> result is the same; all the necessary queries are executed and  
>>>>>> the
>>>>>> datarows for B are put in the cache, but the property on A isn't
>>>>>> updated with the prefetched B. Does anybody know  how to explain
>>>>>> (and fix ;-)) this?
>>>>>>
>>>>>> Thanx,
>>>>>>
>>>>>> Donald Vrakking
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


Mime
View raw message