Hi, unfortunately there is no such feature like type-identification in castor. You have to do it on your own.
Diez ______________________________________________________________________________ Handeln wie die Profis, ganz ohne Risiko. Steigen Sie ein und erleben Sie Berg- und Talfahrt an den B�rsen unter http://boersenspiel.web.deTitle: [EMAIL PROTECTED] schrieb am 25.03.02 -----Ursprüngliche Nachricht wurde als Attachment angehängt.-----
| Von: | [EMAIL PROTECTED] |
| Gesendet: | 25.03.02 |
| An: | "Diez Roggisch" <[EMAIL PROTECTED]> |
| Betreff: | Re: [castor-dev] Saving object type in database |
Der HTML-Inhalt der E-Mail enthielt aktive Elemente wie Java, Javascript oder Formulare.
Diese Teile wurden aus Sicherheitsgründen deaktiviert. Möglicherweise ist die Darstellung der E-Mail dadurch beeinträchtigt.
Hello everyone,
I'm starting to learn how to use Castor, and for this task I have set up a simple project. I want to work with a tree-like structure in a database. I have a simple class tree:
class Thing;
class Block extends Thing;
class Bag extends Thing;
wherein the Bag class has a member called "stuff", which is a collection of other Thing's. (see the attachment for full code; everything is quite straight-forward)
Now when I create a Bag and fill it with some Thing objects, the whole structure is successfully saved in the database, and can also be reloaded. However when I add Bag or Block objects to the Bag, they will come out of the database as Thing objects...
I think that's quite logical, as Castor doesn't save in the database what type an object is. Is there a way to have Castor do this automatically? i.e. without having to implement some getClassName() function or so for all classes?
I hope my problem is a bit clear....
Kind regards & happy coding,
Jan Ypma
