This has brought up an interesting question for me.
I am NOT using any anonymous keys, but i like the principle of them.
The majority of my work is web-based.  Therefore, by not having PKIDs it's
much harder to pass references between requests.
Does anyone have any simple solutions to this problem?

My solution was to store the objects in a hashmap in the session, then pass
the key through html requests.
However, this does make transactions more painful, and it means that you are
storing the retrieved persistant object (whole tree if not proxied) in the
session until it is removed or until the session expires.  This can use a
lot of memory.

I've found it a much cleaner approach in web apps to use ids.  Provide a
service that hands out objects referenced by id or lists of objects when
requested (ie getPerson(int id)) and updates objects using the new data (not
objects) and an id (eg updatePerson(int personId, String newName, String
newJobTitle,...)).

Any thoughts?

Daniel.

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: 03 February 2004 12:34
To: OJB Users List
Subject: Re: Installation of OJB


Hi Ralf,

it does deal with anonymous fields, but only in conjunction with 1:1
references. Please post class-descriptor and source for Customer, Car.

regards,
Armin

Ralf Bode wrote:

> Hi Armin.
>
> okay i didnīt know about 1.0rc5 isnīt
> dealing with anonymous-keys.
>
> so i do like suggested in 1:1-mapping.
>
> but then in my Beans i have
> int carId
> Car car;
>
> i do now:
> setCar(Car c){
> car = c;
> carId = c.getId();
> }
>
> but i think this is redundant, isnīt ?
> now i am very confused on dealing with OJB...
>
> a short, and last question,
> why doesnīt OJB1.0.rc5 not deal with anonymous-keys
> i thought its a nice feature!
>
> greetings ralf
>
>
>  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
>
>>Ralf Bode wrote:
>>
>>>Hi Armin,
>>>thanks for your patience, first!
>>>but the things with declaring PK_Fields
>>>i read at:
>>>
>>
> http://db.apache.org/ojb/howto-use-anonymous-keys.html
>
>>>i did everything like told me :-)
>>>the document is written nice and understandful,
>>
>>doh! Assume the current implementation doesn't
>>achieve this. All
>>anonymous keys are held in an internal map using the
>>object itself as
>>key. Reading will be successful, but when the object
>>e.g. will be
>>serialized and then returned to OJB the anonymous PK
>>field will never be
>>found (object does not match a key), its only
>>possible to extract the FK
>>from the associated reference object.
>>Thus I think anonymous keys will only work in
>>conjunction with 1:1
>>references.
>>I don't write the 'anonymous-key' stuff, so maybe I
>>overlooked an
>>important argument.
>>
>>regards,
>>Armin
>>
>>
>>
>>>but only the little thing
>>>froeign-key is null in my case...
>>>
>>>did you know if this sample is available?
>>>i didnīt found it in src-distribution.
>>>
>>>thanks alot!
>>>
>>> --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
>>
>>Hi
>>
>>>Ralf,
>>>
>>>
>>>>>but in my case the own idīs
>>>>>of a class where anonymous too,
>>>>>is that the matter?
>>>>
>>>>AFAIK we don't have a test case that mix this
>>
>>stuff.
>>
>>>>Think it is not allowed to declare a PK field
>>>>anonymous.
>>>>Recommend you to setup a test case similar to the
>>>>examples in test suite
>>>>or docu
>>>>(http://db.apache.org/ojb/tutorial3.html#Mapping
>>
>>1:1
>>
>>>>associations). As recently as your test pass start
>>>>to tweak ;-)
>>>>
>>>>regards,
>>>>Armin
>>>>
>>>>
>>>>Ralf Bode wrote:
>>>>
>>>>
>>>>>Hi Armin, again...
>>>>>...sorry...
>>>>>
>>>>>i looked in samples you told me!
>>>>>(thanks for tipps!)
>>>>>but i have all so like
>>>>>1:1-relationship
>>>>>org.apache.ojb.broker.ObjectRepository$Group
>>>>>org.apache.ojb.broker.ObjectRepository$Componente
>>>>>(access="anonymous" for reffered ids)
>>>>>but in my case the own idīs
>>>>>of a class where anonymous too,
>>>>>is that the matter?
>>>>>but i donīt think so, because
>>>>>for car and customer a id is "generated".
>>>>>
>>>>>But only!!! the reffered id
>>>>>(in customer for car is "null")
>>>>>
>>>>>...strangely... isnīt it ?
>>>>>
>>>>>perhaps i can send it to list / to you?
>>>>>(i asked, because i will not blow up list
>>>>> with my (i think) foolishness)
>>>>>
>>>>>thanks for your patience!
>>>>>ralf
>>>>>--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
>>>>
>>>>Hi
>>>>
>>>>
>>>>>Ralf,
>>>>>
>>>>>
>>>>>
>>>>>>Ralf Bode wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>hi ... again :-(
>>>>>>>
>>>>>>>it is really frustratingly...
>>>>>>>i turned OTM->true
>>>>>>>made:
>>>>>>>customer.setCar(car)
>>>>>>>broker.store(customer);
>>>>>>>
>>>>>>
>>>>>>I don't know what's wrong with your test, but
>>
>>this
>>
>>>>>>will definitely work
>>>>>>with the PB-api.
>>>>>>You can find many examples in test suite, e.g.
>>>>>>...broker.AnonymousFieldsTest.
>>>>>>
>>>>>>regards,
>>>>>>Armin
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>but same...
>>>>>>>customer is in DB, car not!
>>>>>>>:-(
>>>>>>>
>>>>>>>i have read in aritcle in german-javamag
>>>>>>>on OJB there was said "all is nice"
>>>>>>>
>>>>>>>or am i to stuid?
>>>>>>>
>>>>>>>i though it would be possible
>>>>>>>to store "customer" and his car...
>>>>>>>has anyone a "runnig"-case for an idot, like
>>
>>me?
>>
>>>>>>>thanks!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>--- Brian McCallister
>>>>>>><[EMAIL PROTECTED]> schrieb: >
>>>>>>
>>>>>>Objects
>>>>>>
>>>>>>
>>>>>>
>>>>>>>are not automatically stored by reachability
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>-- the car isn't
>>>>>>>>inserted because it is attached to Customer.
>>>>
>>>>This
>>>>
>>>>
>>>>>>>>*can* actually be
>>>>>>>>done in the OTM if Car is a truly dependent
>>>>
>>>>object
>>>>
>>>>
>>>>>>>>(otm-dependent
>>>>>>>>attribute), but in the PB an object must be
>>
>>made
>>
>>>>>>>>explicitly persistent.
>>>>>>>>
>>>>>>>>broker.store(ca);
>>>>>>>>broker.store(cu);
>>>>>>>>
>>>>>>>>-Brian
>>>>>>>>
>>>>>>>>On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Hi Brian,
>>>>>>>>>now i got an "anonym" id
>>>>>>>>>(very nice, so i now have "pure" javaBeans
>>>>>>>>>no technicals in it :-)
>>>>>>>>>
>>>>>>>>>i made
>>>>>>>>>cu = new Custiomer();
>>>>>>>>>ca = new Car();
>>>>>>>>>cu.setCar(ca);
>>>>>>>>>broker.store(cu);
>>>>>>>>>
>>>>>>>>>now only a customer was in DB
>>>>>>>>>
>>>>>>>>>i must add the "auto-*" in descriptor:
>>>>>>>>><reference-descriptor
>>>>>>>>>name="car"
>>>>>>>>>class-ref="de.ralle.Car"
>>>>>>>>>auto-retrive="true"
>>>>>>>>>auto-update="true"
>>>>>>>>>auto-delete="true">
>>
> === message truncated ===
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to