Discussion:
[Middlegen-user] Issue with airline demo and hibernate
Darin Buck
2005-09-14 21:48:10 UTC
Permalink
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
Rajeev Mittal
2005-09-15 16:12:21 UTC
Permalink
I had the same issue. Could not figure out how to fix it yet.

Rajeev
Post by Darin Buck
middlegen-2.1
java 1.4.2_08
I changed the sample app to use hibernate instead of cmp20, which
[javac] Compiling 1 source file to
/home/gcg/middlegen-2.1/samples/build/classes
[javac]
cannot resolve symbol
[javac] symbol : method setReservationId (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setReservationId(reservationForm.getReservationId());
Post by Darin Buck
[javac] ^
[javac]
cannot resolve symbol
[javac] symbol : method setPersonIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk());
Post by Darin Buck
[javac] ^
[javac]
cannot resolve symbol
[javac] symbol : method setFlightIdFk (java.lang.Integer)
[javac] location: class airline.hibernate.Reservation
[javac]
reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk());
Post by Darin Buck
[javac] ^
[javac]
cannot resolve symbol
[javac] symbol : method getReservationId ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setReservationId(reservationPersistence.getReservationId());
Post by Darin Buck
[javac]
^
[javac]
cannot resolve symbol
[javac] symbol : method getPersonIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setPersonIdFk(reservationPersistence.getPersonIdFk());
Post by Darin Buck
[javac]
^
[javac]
cannot resolve symbol
[javac] symbol : method getFlightIdFk ()
[javac] location: class airline.hibernate.Reservation
[javac]
reservationForm.setFlightIdFk(reservationPersistence.getFlightIdFk());
Post by Darin Buck
[javac]
^
[javac]
setRegistrationUtc(java.sql.Timestamp) in
airline.web.struts.ReservationForm cannot be applied to
(java.util.Date)
[javac]
reservationForm.setRegistrationUtc(reservationPersistence.getRegistrationUtc());
Post by Darin Buck
[javac] ^
[javac]
setDepartureUtc(java.sql.Timestamp) in
airline.web.struts.FlightForm
cannot be applied to (java.util.Date)
[javac]
flightForm.setDepartureUtc(flightPersistence.getDepartureUtc());
[javac] ^
[javac]
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
from
/**
* Copy data from a airline.web.struts.ReservationForm value
object
into a airline.hibernate.Reservation object.
*
airline.hibernate.Reservation object into which the data is to be
copied.
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());
Post by Darin Buck
reservationPersistence.setComment(reservationForm.getComment());
}
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());
Post by Darin Buck
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
-------------------------------------------------------
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42" plasma tv or your very
own
http://sourceforge.net/geronimo.php
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Loading...