On Sat, 29 May 2004 20:02:36 +0200, Stefan Frank wrote:

>
>On Saturday 29 May 2004 10.33, Werner Guttmann wrote:
>> On Sat, 29 May 2004 00:17:15 +0200, Stefan Frank wrote:
>(...)
>> >Because we are developing a three tier client, we can't use caching. The
>> > cache is disabled and we are requesting every object direct from the
>> > database. As a consequence we must lock a record on the database as soon
>> > as we want to modify the desired object (the business-layer is
>> > distributed on different machines).
>> >
>> >I tried to load the object with access-mode (short)3.
>> >
>> >But then PostgreSQL complains:
>> ><---------------------------------------------------------------------->
>> >May 28, 2004 11:47:31 PM org.exolab.castor.jdo.engine.SQLEngine load
>> >SEVERE: A fatal error occurred while loading
>> >ch.fhz.hta.dbsa.server.entities.Organization using SQL: SELECT
>> >"room"."room_id","organization"."address","organization"."city","organizat
>> >ion"."contact_person_department","organization"."contact_person_first_n
>>
>> ame","organization"."contact_person_last_name","organization"."contact_pers
>>on_telefon_number","organization"."fax_number","organization"."nam
>> e","organization"."organization_size","organization"."short_name","organiza
>>tion"."telefon_number","organization"."zip_code","organization"."is_delet
>> ed","organization"."last_edited"
>>
>> >FROM "organization" LEFT OUTER JOIN "room" ON
>> >"organization"."organization_id"="room"."organization_id" WHERE
>> >"organization"."organization_id"=? FOR UPDATE
>> >org.postgresql.util.PSQLException: ERROR: SELECT FOR UPDATE cannot be
>> > applied to the nullable side of an outer join
>> ><---------------------------------------------------------------------->
>> >The problem is obviously, that the Organization-Object holds a collection
>> > of Rooms (a reference would also lead to the error). But as long as this
>> > collection is empty (or the reference is null), PostgreSQL complains
>> > about the nullable side of the outer join.
>> >
>> >Is there any solution available?
>> >
>> >And my last question is about lazy loading.
>> >I have the Room class with a relation (1:1) to the Organization class.
>>
>> Well, actually you happen to have a 1:M relation here, correct ?
>
>That's true. Certainly it is a (1:M) relation. A organization can have M 
>rooms, but a room can only have one organization associated. I just found 
>out, that I missinterpreted the documentation. How can I define a 
>lazy-loading on a reference? 
Well, well.. though there is support for lazy loading in Castor, is is not complete. 
Right now, lazy loading is supported only with collections (1:m relations), 
but we should have support for simple 1:1 relations in the near future as well.

>I mean the Room-class doesn't have a collection of Organization, it only has a 
>reference.
Which is fine, as far as I can tell. Where is the specific problem you are having, 
iima ? 

>I thought that I must use instead a collection. And that's probably the only 
>solution I guess? But do I have to create a seperate table for the N:M 
>relation (although it's only a 1:M relation?).
No, I think you misunderstood things here. An organization needs to have a collection 
of room objects, but not vice versa. ANd lazy loading is 
supported only on the organization --> room leg of this relation. 

I hope this clarifies some of your issues.

Werner



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to