Discussion:
[Middlegen-user] Creating a 0:1 Relationship
lutz behnke
2003-06-20 10:05:52 UTC
Permalink
Hi there,

I am new to middlegen and am trying to create CMP code for the following
tables:

tablea (
identifier int primary key,
name varchar
)

tableb (
BaseEntryID int primary key references tablea(identifier),
label varchar
)

tablec (
BaseEntryID int primary key references tablea(identifier),
value int
)

Now each entry in tablea corresponds with ab entry either in tableb or
tablec. But I do not see how to do this. Unfortunately middlegen
includes calls to setTableb _and_ setTablec calls into the code for
TableaBean. These can obviously not be set, as the relationship is 0..1 one

My build.xml looks like this:

<table name="tablea" generate="true">
<crossref fktable="tableb" fkcolumn="BaseEntryID"/>
<crossref fktable="tablec" fkcolumn="BaseEntryID"/>
</table>
<table name="tableb" generate="true" />
<table name="tablec" generate="true" />


Question I: How do I create 0..1 relationships?
Question II: where can I find documentation for the *-prefs.properties
file?

I use middlegen from CVS, Xdoclet-1.2b3-bin, java-1.4x, ant 1.5

TIA

mfg lutz
--
Lutz Behnke
Hochschule fuer Angewandte Wissenschaften Hamburg
- University of Applied Sciences -

Fachbereich E/I, Softwarelabor, Berliner Tor 7, 20099 Hamburg, Germany
phone: +49 40 42875-8156 mailto:***@informatik.haw-hamburg.de
fax : +49 40 2803770 http://swl.informatik.haw-hamburg.de/~sage
sabat
2003-06-20 13:59:20 UTC
Permalink
Others will probably chime in with more informed answers, but I think
the limitation is going to be CMR itself, in the CMP 2.0 spec. I've
never run across anything like this in CMR (or in the database world for
that matter!). If that's the case, you'll probably need to hand-code this.
Post by lutz behnke
Hi there,
I am new to middlegen and am trying to create CMP code for the
tablea (
identifier int primary key,
name varchar
)
tableb (
BaseEntryID int primary key references tablea(identifier),
label varchar
)
tablec (
BaseEntryID int primary key references tablea(identifier),
value int
)
Now each entry in tablea corresponds with ab entry either in tableb or
tablec. But I do not see how to do this. Unfortunately middlegen
includes calls to setTableb _and_ setTablec calls into the code for
TableaBean. These can obviously not be set, as the relationship is 0..1 one
<table name="tablea" generate="true">
<crossref fktable="tableb" fkcolumn="BaseEntryID"/>
<crossref fktable="tablec" fkcolumn="BaseEntryID"/>
</table>
<table name="tableb" generate="true" />
<table name="tablec" generate="true" />
Question I: How do I create 0..1 relationships?
Question II: where can I find documentation for the
*-prefs.properties
file?
I use middlegen from CVS, Xdoclet-1.2b3-bin, java-1.4x, ant 1.5
TIA
mfg lutz
lutz behnke
2003-06-23 04:10:05 UTC
Permalink
Post by sabat
Others will probably chime in with more informed answers, but I think
the limitation is going to be CMR itself, in the CMP 2.0 spec. I've
never run across anything like this in CMR (or in the database world for
that matter!). If that's the case, you'll probably need to hand-code this.
Thanks for the answer. I will read the CMP Spec to check. Now I at least
know where to find out.

[OT Warning]
But your second comment astounds me. How do you implement Object
Inheritance in a RDBMS if not this way?

mfg lutz
--
Lutz Behnke
Hochschule fuer Angewandte Wissenschaften Hamburg
- University of Applied Sciences -

Fachbereich E/I, Softwarelabor, Berliner Tor 7, 20099 Hamburg, Germany
phone: +49 40 42875-8156 mailto:***@informatik.haw-hamburg.de
fax : +49 40 2803770 http://swl.informatik.haw-hamburg.de/~sage
sabat
2003-06-23 04:59:05 UTC
Permalink
Post by lutz behnke
Post by sabat
Others will probably chime in with more informed answers, but I think
the limitation is going to be CMR itself, in the CMP 2.0 spec. I've
never run across anything like this in CMR (or in the database world
for that matter!). If that's the case, you'll probably need to
hand-code this.
Thanks for the answer. I will read the CMP Spec to check. Now I at
least know where to find out.
[OT Warning]
But your second comment astounds me. How do you implement Object
Inheritance in a RDBMS if not this way?
Well, my comment probably shows my ignorance of object-oriented
databases; I've only worked with the relational world. However, I'm not
sure whether EJBs are meant to work with anything but relational DBs.
Now, if you actually literally mean object inheritance with an RDBMS --
remember, EJBs were just meant to represent data, simple data. They
aren't all that sophisticated yet, and representing full-on objects
might be beyond what the spec is able to deliver.
Post by lutz behnke
mfg lutz
Loading...