Discussion:
[Middlegen-user] how to generate foreign key access methods ?
Eric Lacroix
2002-08-05 12:02:10 UTC
Permalink
I want to have methods to get foreign keys values.
I seems that I need @ejb.interface-method view-type="local" tag in my
ejb/*Bean.java files for fk access methods.

Is there something to configure somewhere for that, or do I need to
modify entity-cmp-20.vm ? In the second case, things I tried didn't
worked.

thanks,

Eric.
a***@netcom.no
2002-08-05 12:26:05 UTC
Permalink
The airline sample out of the box generates accessors for foreign key
fields. (See par example the generated ReservationLocal.getFlightIdFk()
method).

The @ejb.interface-method view-type="local" tag will appear in
accessors that correspond to foreign keys if all the following
conditions are met:

1) <cmp20 fkcmp="true"/>
2) You haven't unchecked the corrsponding "getter" checkbox in the GUI.

HTH,
Aslak

----- Original Message -----
From: Eric Lacroix <***@free.fr>
Date: Monday, August 5, 2002 4:03 pm
Subject: [Middlegen-user] how to generate foreign key access methods ?
Post by Eric Lacroix
I want to have methods to get foreign keys values.
ejb/*Bean.java files for fk access methods.
Is there something to configure somewhere for that, or do I need to
modify entity-cmp-20.vm ? In the second case, things I tried didn't
worked.
thanks,
Eric.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Eric Lacroix
2002-08-05 12:42:02 UTC
Permalink
Post by a***@netcom.no
The airline sample out of the box generates accessors for foreign key
fields. (See par example the generated ReservationLocal.getFlightIdFk()
method).
accessors that correspond to foreign keys if all the following
1) <cmp20 fkcmp="true"/>
2) You haven't unchecked the corrsponding "getter" checkbox in the GUI.
How to handle condition 2 while I'm not using the GUI ?

Thx,

Eric.
a***@netcom.no
2002-08-05 12:51:02 UTC
Permalink
The default behaviour is that the local getBlaBla() methods are checked
(even if you don't use the gui). However, the default behaviour is
overridden if a prefs.xml exists and says otherwise. You can either:

-Remove your prefs.xml (and thereby reset Middlegen's behaviour to
default).

OR

-Run the gui once, see that everything is OK (check the boxes you want)
and don't run it in the future. (Doing things in the GUI will
indirectly modify the prefs.xml file and Middlegen remembers this for
the future, even if GUI is off)

Aslak

----- Original Message -----
From: Eric Lacroix <***@free.fr>
Date: Monday, August 5, 2002 4:43 pm
Subject: Re: [Middlegen-user] how to generate foreign key access
methods ?
Post by Eric Lacroix
Post by a***@netcom.no
The airline sample out of the box generates accessors for
foreign key
Post by a***@netcom.no
fields. (See par example the generated
ReservationLocal.getFlightIdFk()
Post by a***@netcom.no
method).
accessors that correspond to foreign keys if all the following
1) <cmp20 fkcmp="true"/>
2) You haven't unchecked the corrsponding "getter" checkbox in
the GUI.
How to handle condition 2 while I'm not using the GUI ?
Thx,
Eric.
Eric Lacroix
2002-08-05 13:41:03 UTC
Permalink
Post by a***@netcom.no
[...]
-Remove your prefs.xml (and thereby reset Middlegen's behaviour to
default).
OR
-Run the gui once, see that everything is OK (check the boxes you want)
and don't run it in the future. (Doing things in the GUI will
indirectly modify the prefs.xml file and Middlegen remembers this for
the future, even if GUI is off)
Ok, but I can't find any prefs.xml nor any save button in the GUI. The
on ly button on the GUI is generate. I don't have a File (menu ?) like
the one on the screenshot from the website.

No prefs.xml file is created.

Did I miss something ?

I'm using today cvs snapshot of middlegen, GNU/linux OS, jdk 1.3.


Eric.
a***@netcom.no
2002-08-05 13:51:02 UTC
Permalink
There isn't a save button. prefs.xml is saved when you exit the gui,
but you need JDK 1.4.

Since you are on JDK 1.3, Middlegen will not attempt to read (or write)
prefs.xml, so default behaviour (generate getters for fks as long as
fkcmp="true") should happen every time.

Put simply, fkcmp="true" should be enough. Tell me, don't you get the
getters on the fks in the sample?

Aslak

----- Original Message -----
From: Eric Lacroix <***@free.fr>
Date: Monday, August 5, 2002 5:42 pm
Subject: Re: [Middlegen-user] how to generate foreign key access
methods ?
Post by a***@netcom.no
Post by a***@netcom.no
[...]
-Remove your prefs.xml (and thereby reset Middlegen's behaviour
to
Post by a***@netcom.no
default).
OR
-Run the gui once, see that everything is OK (check the boxes
you want)
Post by a***@netcom.no
and don't run it in the future. (Doing things in the GUI will
indirectly modify the prefs.xml file and Middlegen remembers
this for
Post by a***@netcom.no
the future, even if GUI is off)
Ok, but I can't find any prefs.xml nor any save button in the GUI. The
on ly button on the GUI is generate. I don't have a File (menu ?) like
the one on the screenshot from the website.
No prefs.xml file is created.
Did I miss something ?
I'm using today cvs snapshot of middlegen, GNU/linux OS, jdk 1.3.
Eric.
Eric Lacroix
2002-08-05 14:03:01 UTC
Permalink
Post by a***@netcom.no
Put simply, fkcmp="true" should be enough. Tell me, don't you get the
getters on the fks in the sample?
Unfortunatly I don't get the getters with my database even with
fkcmp="true" . I haven't test the Airline example yet.
By default in the gui, the getters are not checked for the fks.

The ones I checked are generated as I want.

Eric.

Loading...