db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Mahler <thm...@web.de>
Subject Re: Mapping multiple objects to the same table
Date Wed, 03 Sep 2003 08:03:22 GMT
Hi David,

David Mann wrote:
> It seems like OJB may have some objection to mapping more than one class to
> a table.  

Why do you think so?

> Examples of this could be classes with a subset of properties
> commonly used in queries (lightweight), .... to allow use of the
> PersistenceBroker getCollectionByQuery API.  

Exactly. And that's why we even recommend this kind of mapping as best 
practise for certain situations.

Here is a recent sample posting from our user list:
"I have got a solution of Tomas Mahler and thought that I would share 
it. It is very simple once you realise that there arn't a 1-1 relation 
between class-description and database-table but a n-1. You can have as 
many classes mapping to one database-table as you like and find use of.

So the solution to how to avoid an OutOfMemory error handling blobs are 
to separate your class holding the blob into two. If you like me have a
Picture-class separate them into  PictureInfo and  PictureData where the
PictureInfo holds all values about the picture that are not the 
picture-data while the PictureData only holds the id and data. When you 
need the data of the picture let the PictureInfo-class load an object of 
PictureData (lazy-loading)."


> While it can be subverted by
> changing case of the table attribute in the class descriptor, I cannot
> determine why the objection in the first place. >
> Is there any problems in pursuing this pattern of usage ?
>
As mentioned above: there is NO problem with this approach.
If there are spots in our documentation that gave you this impression we 
have to change them! Where did you get this from?

cheers,
Thomas

> David Mann
> Montreal
>  
>  
> 
> 
> ****************************************************************************
> 
> This e-mail may be privileged and/or confidential, and the sender does not
> waive any related rights and obligations. Any distribution, use or copying
> of this e-mail or the information it contains by other than an intended
> recipient is unauthorized. If you received this e-mail in error, please
> advise me (by return e-mail or otherwise) immediately. 
> 
> Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux
> droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou
> copie de ce message ou des renseignements qu'il contient par une personne
> autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez
> ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de
> courriel ou par un autre moyen.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message