Discussion:
[Middlegen-user] RE: [Xdoclet-user] Directionality CMR Question
Aslak Hellesøy
2003-01-27 14:09:05 UTC
Permalink
-----Original Message-----
Sent: 27. januar 2003 16:49
To: Aslak Hellesøy
Subject: Re: [Xdoclet-user] Directionality CMR Question
Thanks for the replies, good to know I'm on the right lines.
I've never used Middlegen, and I'd like to be able to set up cmr
relationships easier so perhaps this
is the way to go. However I want to create an application from scratch (I
have no database setup yet).
If you intend to have complex relationships with funny
dircetionality/cardinality schemes, I would strongly recommend a bottom-up
approach. Start with the database schema and let Middlegen+XDoclet generate
all that funny code for you.

Setting up a database just in order to do development might seem a bit
complicated, but in fact is isn't ;-) I'm using hsqldb (comes with
Middlegen) to do this. It's a 100% java database that requires *no*
installation!
Does Middlegen pre-suppose a database and you create the table
relationships
from that (kinda like
Middlegen expects a preexisting database with proper relations. (Use
REFERENCES syntax when setting up foreign keys).
ms-access) and then create the ejbs for you? And can you then bring those
ejbs to a different database
and drop them in and have the tables created for you?
Spot on!
Sorry if this is verging on the middlegen topic rather than the xdoclet
topic, but it's probably good to know
from an xdoclet point of view too.
cheers,
Brian
I suggest you take a look at the Middlegen demo (requires Flash)
http://boss.bekk.no/boss/middlegen/demo.html

And walk through the tutorial:
http://boss.bekk.no/boss/middlegen/getstarted/index.html

Hopefully Middlegen is the right tool for you.
----- Original Message -----
Sent: Monday, January 27, 2003 3:31 PM
Subject: RE: [Xdoclet-user] Directionality CMR Question
-----Original Message-----
Suleiman
Sent: 27. januar 2003 15:53
To: Aslak Hellesøy
Cc: Brian McSweeney; xdoclet
Subject: RE: [Xdoclet-user] Directionality CMR Question
This brings up a related issue I've been having trouble
with...How would
I
handle the case where the relation PK is a compound primary key?
Eg, if in the
example below, Address has multiple PK fields. I can't
specify multiple
related-pk-field tag attributes, so what is the correct way of
handling this?
Just use one
@jboss.relation or @weblogic.column-map tag for each related column.
These are tags that can be specified many times.
Enclosed is a little Middlegen screenshot to illustrate that Middlegen
supports this too ;-)
Aslak
That looks ok. Why don't you try it and see if it works??
Aslak
-----Original Message-----
McSweeney
Sent: 27. januar 2003 11:57
To: xdoclet
Subject: [Xdoclet-user] Directionality CMR Question
Hi all,
I'm getting a bit confused with implementing my database design with
ejb
CMR
and xdoclet.
I have two beans A and B. Each of these beans have an address
that I want
to
factor out into
AddressEJB.
So I want it so that bean A and AddressEJB is 1-1,
and bean B and AddressEJB is also 1-1.
I think the right way to do this is making the relationships
unidirectional,
ie, either A or B can
get back their AddressEJB, but the Address can't get back it's
bean A or B.
I think this is the
right way to do it because otherwise the AddressEJB would
have to have
a
get
method for both
A and B. However I'm not sure if it can be done at all.
I'd love some advice as to whether I'm going along the right way or
not.
Here's what I'm thinking
about in terms of my xdoclet code.
Example of my xdoclet code for bean A.
/**
* name="abean-address"
* role-name="abean-has-address"
* target-ejb="Address"
* target-role-name="address-belongs_to-abean"
* target-cascade-delete="yes"
* fk-column="addressId_fk"
* related-pk-field="addressId"
*/
public abstract AddressLocal getAddress();
public abstract void setAddress( AddressLocal address );
thanks very much,
Brian
-------------------------------------------------------
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Xdoclet-user mailing list
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
-------------------------------------------------------
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Xdoclet-user mailing list
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
Loading...