> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Rupp,Heiko
> Sent: 27. januar 2003 13:26
> To: Xdoclet-User (E-Mail)
> Subject: [Xdoclet-user] Simple Example of CMR and using it?
>
>
> Hi,
>
> does anyone have a very simple and stripped down example of a CMR
> and how to access it (Possibly tailored for JBoss)?
> I know middlegen and it is very cool, but it generates so much code
> that goes far beyond a simple example.
>

No it doesn't. Middlegen will only generate one *Bean.java for each of your
tables. You choose in your build script what you want Middlegen to generate.
Just strip away everything except cmp20.

And make sure you only have a PERSON and EMAIL table in your RDBMS.

This way Middlegen will generate only 2 files, PersonBean.java and
EmailBean.java. Promise.

> What I am looking for is something like
>
>  +----------+                +----------+
>  | Person   |                | Email    |
>  +----------+                +----------+
>  | Name     | -1------>---*- | EAddr    |
>  | FirstName|                +----------+
>  +----------+
>
> Where a person object can link to several email addresses for a person.
>
(I used Middlegen to create this)

   /**
    * @ejb.interface-method view-type="local"
    *
    * @ejb.relation
    *    name="person-email"
    *    role-name="person-has-emails"
    *    target-ejb="Email"
    *    target-role-name="email-belongs-to-person"
    *    target-multiple="no"
    *
    * @weblogic.target-column-map
    *    foreign-key-column="person_id_fk"
    *    key-column="person_id"
    *
    * @jboss.relation-mapping style="foreign-key"
    *
    * @jboss.target-relation
    *    fk-constraint="true"
    *    fk-column="person_id_fk"
    *    related-pk-field="personId"
    *
    */
   public abstract java.util.Collection getEmails();


> Please add also a code snippet on how to e.g. create a person with an
> email address.
>

1) create a new Person (the EJB way via local home interface)
2) Create a new Email (the same way)
3) person.getEmails().add(email)

> I have some code, but am obviously missing something obvious, so I'd like
> to compare.
>
>   Thanks
>       Heiko
>

HTH,
Aslak

> --
> Bancotec GmbH      EMail: [EMAIL PROTECTED]
> Calwer Str. 33     Telefon: +49 711 222 992 900
> D-70173 Stuttgart  Telefax: +49 711 222 992 999
> Ein Unternehmen der Cellent AG http://www.cellent.de/
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to