Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
I hope this is useful to some one.

Jim Brady

Bean code - ejbCreate method(s)
add -
setFlightIdFk(flight.getFlightId());
setPersonIdFk(person.getPersonId());

remove generated code from ejbPostCreate method(s)
setFlight(flight);
setPerson(person);

InsertReservationAction - perform method

add before return mapping....

try {
airline.ejb.ReservationLocal reservation =3D airline.ejb.Reser=
vationUtil.getLocalHome().create(
reservationForm.getRegistrationUtc(),
reservationForm.getComment(),
getFlight(reservationForm),
getPerson(reservationForm)
);

// primary key may be generated, so important to forward the a=
ctual PK

request.setAttribute("reservationId", reservation.getReservati=
onId().toString());
request.setAttribute("personIdFk", reservation.getPersonIdFk()=
.toString());
request.setAttribute("flightIdFk", reservation.getFlightIdFk()=
.toString());

} catch (NamingException e) {
getServlet().log("Lookup error", e);
request.setAttribute("name", "Reservation");
return mapping.findForward("error");
} catch (CreateException e) {
getServlet().log("Create error", e);
request.setAttribute("name", "Reservation");
return mapping.findForward("error");
}

UpdateReservationAction - perform method

add before return mapping....

try {
airline.ejb.ReservationLocalHome home =3D airline.ejb.Reservat=
ionUtil.getLocalHome();

java.lang.Integer reservation_ID =3D reservationForm.getReserv=
ationId();
java.lang.Integer person_FK =3D reservationForm.getPersonIdFk(=
);
java.lang.Integer flight_FK =3D reservationForm.getFlightIdFk(=
);

airline.ejb.ReservationPK reservation_PK =3D new airline.ejb.R=
eservationPK( reservation_ID,
person_FK, flight_FK );

request.setAttribute("reservationId", reservation_ID.toString(=
));
request.setAttribute("personIdFk", person_FK.toString());
request.setAttribute("flightIdFk", flight_FK.toString());

airline.ejb.ReservationLocal reservation =3D home.findByPrimar=
yKey(reservation_PK);
reservationForm.copyTo(reservation);

} catch (NamingException e) {
getServlet().log("Lookup error", e);
request.setAttribute("name", "Person");
return mapping.findForward("jndi-naming-exception");
} catch (FinderException e) {
getServlet().log("Find error", e);
request.setAttribute("name", "Person");
return mapping.findForward("ejb-finder-exception");
}



Datum: 25.07.2003 12:21
An: middlegen-***@lists.sf.net



Betreff: Middlegen (2.0 b1) airline application under JBoss
Nachrichtentext:

Hi all,

OK I have come further and now I really want to find somebody who knows=
what to do!

The problem with AbstractReplicatedStore is due to the parameter in web=
.xml <distributable/>.
You just need to remove it. This problem will stop you from editing ent=
ities so it is not just cosmetic.

By fiddling with some parameters and adding the foreign keys to all the=
reservations jsp I can view anyexisting reservations properly - I just=
can't change them.
I always get a null pointer exception in viewReservationAction. (The co=
de is:
value =3D req.getAttribute(name).toString();
but neither req nor name is null I checked.)

Does anybody know what you need to do to get the edit/insert functions =
with foreign keys to work? I know the Struts generation does not work, =
but I am quite prepared to make the changes manually if somebody can te=
ll me what needs to be done. I have looked through the webs and bug lis=
ts but came up a blank.

Jim Brady

Datum: 23.07.2003 09:23
An: middlegen-***@lists.sf.net



Betreff: Antwort: Middlegen application under JBoss 3.2.1
Nachrichtentext:

I forgot say - I am using Middlegen-2.0-b1 - perhaps of course there is=
a bug with the CMR part?
Jim

Datum: 22.07.2003 15:00
An: middlegen-***@lists.sf.net



Betreff: Middlegen application under JBoss 3.2.1
Nachrichtentext:
Hi,
I have been trying to use JBoss 3.2.1 because it supports compound ke=
ys (unlike JBoss 3.0).
Everything seems to work except:
1. I keep getting the following error message in JBoss although it is n=
ot fatal I'm concerned it might be important!
ERROR [SubscribingInterceptor] could not get AbstractReplicatedStore.
2. Foreign keys do not appear in the forms - how do you set them? Any a=
ttempt to create a table entry with a foreign key fails with a null exc=
eption (of course since I haven't said what the foreign keys are). Do I=
have to do something to set up the foreign keys?
3. When I generated source using my own database I had to make two chan=
ges:
a. For database DATE fields I had to change new java.sql.Date to ja=
va.sql.Date.valueOf in several places.
b. I had to change java.math.BigDecimal to java.lang.Double in orde=
r to get the EJB QL to be accepted by JBOSS.
4. I had to fiddle with the dependencies in the build.xml in order to g=
enerate the source and then run just the compile & deploy targets. Is t=
here a nice way to do that?

Jim Brady

(Still fairly new to the incredibly complex world of J2EE. Thanks for t=
he product for all the problems I have had it certainly gives me a head=
start. What I would like is for you to integrate into Eclipse/Lomboz s=
o that I can use a development tool for extending the starter applicati=
on we can build using Middlegen. You should be fairly compatible as Lom=
boz uses xdoclet. I have been importing the generated source - the bigg=
est issue I have is that Lomboz builds sometimes fall over and don't sa=
y why!)










--

Diese E-Mail enth=E4lt vertrauliche und/oder rechtlich gesch=FCtzte Inf=
ormationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail=
irrt=FCmlich erhalten haben, informieren Sie bitte sofort den Absender=
und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbef=
ugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If =
you are not the intended recipient (or have received this e-mail in err=
or) please notify the sender immediately and destroy this e-mail. Any u=
nauthorized copying, disclosure or distribution of the material in this=
e-mail is strictly forbidden.
=

Loading...