Darin Buck
2005-09-14 21:48:10 UTC
Using:
middlegen-2.1
java 1.4.2_08
I changed the sample app to use hibernate instead of cmp20, which
results in a broken build:
compile-adapter:
[javac] Compiling 1 source file to
/home/gcg/middlegen-2.1/samples/build/classes
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:21:
cannot resolve symbol
[javac] symbol : method setReservationId (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setReservationId(reservationForm.getReservationId());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:22:
cannot resolve symbol
[javac] symbol : method setPersonIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:23:
cannot resolve symbol
[javac] symbol : method setFlightIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:36:
cannot resolve symbol
[javac] symbol : method getReservationId ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setReservationId(reservationPersistence.getReservationId());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:37:
cannot resolve symbol
[javac] symbol : method getPersonIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setPersonIdFk(reservationPersistence.getPersonIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:38:
cannot resolve symbol
[javac] symbol : method getFlightIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setFlightIdFk(reservationPersistence.getFlightIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:39:
setRegistrationUtc(java.sql.Timestamp) in
airline.web.struts.ReservationForm cannot be applied to
(java.util.Date)
[javac]
reservationForm.setRegistrationUtc(reservationPersistence.getRegistrationUtc());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:67:
setDepartureUtc(java.sql.Timestamp) in airline.web.struts.FlightForm
cannot be applied to (java.util.Date)
[javac]
flightForm.setDepartureUtc(flightPersistence.getDepartureUtc());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:68:
setArrivalUtc(java.sql.Timestamp) in airline.web.struts.FlightForm
cannot be applied to (java.util.Date)
[javac]
flightForm.setArrivalUtc(flightPersistence.getArrivalUtc());
[javac] ^
[javac] 9 errors
Looking at the first error in the code, it appears that the generated
value object isn't using the generated composite key object:
here is what is generated:
from middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:
/**
* Copy data from a airline.web.struts.ReservationForm value object
into a airline.hibernate.Reservation object.
*
* @param reservationPersistence The
airline.hibernate.Reservation object into which the data is to be
copied.
* @param reservationForm The
airline.web.struts.ReservationForm value object containing the data to
be copied.
*/
protected static void
copyVoToPersistence(airline.hibernate.Reservation
reservationPersistence, airline.web.struts.ReservationForm
reservationForm) throws Exception {
// Persistence layer specific implementation
reservationPersistence.setReservationId(reservationForm.getReservationId());
reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk());
reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk());
reservationPersistence.setRegistrationUtc(reservationForm.getRegistrationUtc());
reservationPersistence.setComment(reservationForm.getComment());
}
Instead it should probably look more like:
protected static void
copyVoToPersistence(airline.hibernate.Reservation
reservationPersistence, airline.web.struts.ReservationForm
reservationForm) throws Exception{
// Persistence layer specific implementation
reservationPersistence.setComp_id(new
airline.hibernate.ReservationPK(reservationForm.getReservationId(),
reservationForm.getPersonIdFk(), reservationForm.getFlightIdFk()));
reservationPersistence.setRegistrationUtc(reservationForm.getRegistrationUtc());
reservationPersistence.setComment(reservationForm.getComment());
}
The same issue exists with the "copyPersistenceToVo" method.
Hopefully there is just some sort of configuration that I messed up.
The cmp20 version worked fine, though.
Thanks for reading this far...
-Darin
middlegen-2.1
java 1.4.2_08
I changed the sample app to use hibernate instead of cmp20, which
results in a broken build:
compile-adapter:
[javac] Compiling 1 source file to
/home/gcg/middlegen-2.1/samples/build/classes
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:21:
cannot resolve symbol
[javac] symbol : method setReservationId (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setReservationId(reservationForm.getReservationId());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:22:
cannot resolve symbol
[javac] symbol : method setPersonIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:23:
cannot resolve symbol
[javac] symbol : method setFlightIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:36:
cannot resolve symbol
[javac] symbol : method getReservationId ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setReservationId(reservationPersistence.getReservationId());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:37:
cannot resolve symbol
[javac] symbol : method getPersonIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setPersonIdFk(reservationPersistence.getPersonIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:38:
cannot resolve symbol
[javac] symbol : method getFlightIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setFlightIdFk(reservationPersistence.getFlightIdFk());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:39:
setRegistrationUtc(java.sql.Timestamp) in
airline.web.struts.ReservationForm cannot be applied to
(java.util.Date)
[javac]
reservationForm.setRegistrationUtc(reservationPersistence.getRegistrationUtc());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:67:
setDepartureUtc(java.sql.Timestamp) in airline.web.struts.FlightForm
cannot be applied to (java.util.Date)
[javac]
flightForm.setDepartureUtc(flightPersistence.getDepartureUtc());
[javac] ^
[javac] /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:68:
setArrivalUtc(java.sql.Timestamp) in airline.web.struts.FlightForm
cannot be applied to (java.util.Date)
[javac]
flightForm.setArrivalUtc(flightPersistence.getArrivalUtc());
[javac] ^
[javac] 9 errors
Looking at the first error in the code, it appears that the generated
value object isn't using the generated composite key object:
here is what is generated:
from middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java:
/**
* Copy data from a airline.web.struts.ReservationForm value object
into a airline.hibernate.Reservation object.
*
* @param reservationPersistence The
airline.hibernate.Reservation object into which the data is to be
copied.
* @param reservationForm The
airline.web.struts.ReservationForm value object containing the data to
be copied.
*/
protected static void
copyVoToPersistence(airline.hibernate.Reservation
reservationPersistence, airline.web.struts.ReservationForm
reservationForm) throws Exception {
// Persistence layer specific implementation
reservationPersistence.setReservationId(reservationForm.getReservationId());
reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk());
reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk());
reservationPersistence.setRegistrationUtc(reservationForm.getRegistrationUtc());
reservationPersistence.setComment(reservationForm.getComment());
}
Instead it should probably look more like:
protected static void
copyVoToPersistence(airline.hibernate.Reservation
reservationPersistence, airline.web.struts.ReservationForm
reservationForm) throws Exception{
// Persistence layer specific implementation
reservationPersistence.setComp_id(new
airline.hibernate.ReservationPK(reservationForm.getReservationId(),
reservationForm.getPersonIdFk(), reservationForm.getFlightIdFk()));
reservationPersistence.setRegistrationUtc(reservationForm.getRegistrationUtc());
reservationPersistence.setComment(reservationForm.getComment());
}
The same issue exists with the "copyPersistenceToVo" method.
Hopefully there is just some sort of configuration that I messed up.
The cmp20 version worked fine, though.
Thanks for reading this far...
-Darin