Adrian Hallam
2002-10-04 16:13:05 UTC
Hello,
Thanks very much to Joe and Asluk for info on my last
post. My problem was with not having InnoDB enabled in
MySQL. Since then I have been busy building stuff and
learning how this all works. I am now at a point where
I have the same problem as Kasper in his post with the
same subject as this post. I thought I'd try out
something similar with the airline example and I got
the same problem there.
I got the latest version out of CVS a few hours ago
and re-tested. The JBoss server is 3.0.2 and the
airline-ejb.jar file deploys with no problems.
However, when I run the following code:
// Start code snippet
FlightLocalHome ejbFlightLH =
FlightUtil.getLocalHome();
FlightLocal ejbFlight = ejbFlightLH.create("String1",
new Timestamp(new
GregorianCalendar().getTimeInMillis()),
new Timestamp(new
GregorianCalendar().getTimeInMillis()));
myLogger.info("This Works");
PersonLocalHome ejbPersonLH =
PersonUtil.getLocalHome();
PersonLocal ejbPerson = ejbPersonLH.create("Adrian",
"Hallam");
myLogger.info("This Works");
ReservationLocalHome ejbReservationLH =
ReservationUtil.getLocalHome();
ReservationLocal ejbReservation =
ejbReservationLH.create(
new Timestamp(new
GregorianCalendar().getTimeInMillis()), ejbPerson,
ejbFlight);
myLogger.info("This doesn't work");
// End code snippet
The above code causes the following error message in
the JBoss log:
Executing SQL: INSERT INTO reservations
(reservation_id, person_id_fk, flight_id_fk,
registration_utc, comment, person_id_fk, flight_id_fk)
VALUES (?, ?, ?, ?, ?, ?, ?)
...
java.sql.SQLException: General error: Column
'flight_id_fk' specified twice
The problem obviously being the two instances of
person_id_fk in the INSERT statement. Kasper got this
problem with a Sapdb datasource and I am getting it
with MySql so it is probably not a data source issue.
It may be a JBoss bug though?
Is the code above that I used to populate the objects
close enough to correct?
Has anyone else got this working with some differences
(such as different JBoss version or different
database)?
I have attached more info from the Jboss logs. If it
doesn't come through or it would help to have a copy
of the .war used to test this then let me know and
I'll send it.
cheers,
Adrian
http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends
Thanks very much to Joe and Asluk for info on my last
post. My problem was with not having InnoDB enabled in
MySQL. Since then I have been busy building stuff and
learning how this all works. I am now at a point where
I have the same problem as Kasper in his post with the
same subject as this post. I thought I'd try out
something similar with the airline example and I got
the same problem there.
I got the latest version out of CVS a few hours ago
and re-tested. The JBoss server is 3.0.2 and the
airline-ejb.jar file deploys with no problems.
However, when I run the following code:
// Start code snippet
FlightLocalHome ejbFlightLH =
FlightUtil.getLocalHome();
FlightLocal ejbFlight = ejbFlightLH.create("String1",
new Timestamp(new
GregorianCalendar().getTimeInMillis()),
new Timestamp(new
GregorianCalendar().getTimeInMillis()));
myLogger.info("This Works");
PersonLocalHome ejbPersonLH =
PersonUtil.getLocalHome();
PersonLocal ejbPerson = ejbPersonLH.create("Adrian",
"Hallam");
myLogger.info("This Works");
ReservationLocalHome ejbReservationLH =
ReservationUtil.getLocalHome();
ReservationLocal ejbReservation =
ejbReservationLH.create(
new Timestamp(new
GregorianCalendar().getTimeInMillis()), ejbPerson,
ejbFlight);
myLogger.info("This doesn't work");
// End code snippet
The above code causes the following error message in
the JBoss log:
Executing SQL: INSERT INTO reservations
(reservation_id, person_id_fk, flight_id_fk,
registration_utc, comment, person_id_fk, flight_id_fk)
VALUES (?, ?, ?, ?, ?, ?, ?)
...
java.sql.SQLException: General error: Column
'flight_id_fk' specified twice
The problem obviously being the two instances of
person_id_fk in the INSERT statement. Kasper got this
problem with a Sapdb datasource and I am getting it
with MySql so it is probably not a data source issue.
It may be a JBoss bug though?
Is the code above that I used to populate the objects
close enough to correct?
Has anyone else got this working with some differences
(such as different JBoss version or different
database)?
I have attached more info from the Jboss logs. If it
doesn't come through or it would help to have a copy
of the .war used to test this then let me know and
I'll send it.
cheers,
Adrian
http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends