The RowReader approach might not work if you are not willing to store
the collection on the object, as I was thinking you can interrogate the
collection after retrieval and before being passed to the application to
set that number.

 

> -----Original Message-----
> From: Andrey Shulinskiy [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 09, 2005 10:49 AM
> To: OJB Users List
> Subject: RE: OJB question - "reference counter" field
> 
> Andrew,
> 
> thanks a lot for the prompt reply.
> 
> > -----Original Message-----
> > From: Clute, Andrew [mailto:[EMAIL PROTECTED]
> > Sent: Monday, August 08, 2005 9:21 PM
> > To: OJB Users List
> > Subject: RE: OJB question - "reference counter" field
> >
> >
> > In a word: no. There is no straight forward way to do what 
> you want to 
> > accomplish.
> >
> > Obviously you can manage that yourself by setting the value to the 
> > size of the collection before saving, and then having that field in 
> > the database.
> 
> I don't want the collection of Bs to be in the A class at all 
> - just the size.
> 
> > At first I thought a field conversion might work, but it has no 
> > context to look at other fields.
> >
> > You can write a custom row reader for this object type that 
> looks at 
> > the other field and populates the size variable. But you are still 
> > going to have to manage that field yourself when the collection is 
> > mutated.
> >
> > Take a look at:
> >
> > org.apache.ojb.broker.accesslayer.RowReader
> 
> OK, thanks, it should be a solution.
> 
> Yours sincerely,
> Andrey.
> 
> >
> > -Andrew
> >
> >
> > -----Original Message-----
> > From: Andrey Shulinskiy [mailto:[EMAIL PROTECTED]
> > Sent: Mon 8/8/2005 9:01 PM
> > To: ojb-user@db.apache.org
> > Subject: OJB  question - "reference counter" field
> >
> > Hi there!
> >
> > I am quite new to OJB and I'd really appreciate if anybody 
> could help 
> > me with the following issue.
> >
> > The case is rather simple:
> > tables A and B have the 1 - N relationship. And I want the 
> objects of 
> > the class A have not the collection of the related objects 
> B but just 
> > the number of such objects:
> >
> > class A {
> > ...
> >     private Integer bCounter;
> > ...
> > }
> >
> > So the questions are - is it possible in OJB and if it is then how 
> > could it be done? Is it just some kind of mapping ore 
> something more 
> > complicated?
> > Thanks.
> >
> > Yours sincerely,
> > Andrey Shulinskiy.
> >
> >
> > 
> ---------------------------------------------------------------------
> > 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