Re: Issue with airline demo and hibernate
Rajeev Mittal <[email protected]> Thu, 15 Sep 2005 11:10:55 -0700 (PDT)
| Newsgroups | gmane.comp.java.ejb.middlegen.user |
|---|---|
| Message-ID | <[email protected]> |
I had the same issue. Could not figure out how to fix it yet. Rajeev --- Darin Buck <[email protected]> wrote: > Using: > middlegen-2.1 > java 1.4.2_08 >=20 > I changed the sample app to use hibernate instead of cmp20, which > results in a broken build: >=20 > 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/TranslatorU= til.java:21: > cannot resolve symbol > [javac] symbol : method setReservationId (java.lang.Integer) > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationPersistence.setReservationId(reservationForm.getReservationId(= )); > [javac] ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:22: > cannot resolve symbol > [javac] symbol : method setPersonIdFk (java.lang.Integer) > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk()); > [javac] ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:23: > cannot resolve symbol > [javac] symbol : method setFlightIdFk (java.lang.Integer) > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk()); > [javac] ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:36: > cannot resolve symbol > [javac] symbol : method getReservationId () > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationForm.setReservationId(reservationPersistence.getReservationId(= )); > [javac] =20 > ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:37: > cannot resolve symbol > [javac] symbol : method getPersonIdFk () > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationForm.setPersonIdFk(reservationPersistence.getPersonIdFk()); > [javac] =20 > ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:38: > cannot resolve symbol > [javac] symbol : method getFlightIdFk () > [javac] location: class airline.hibernate.Reservation > [javac] =20 > reservationForm.setFlightIdFk(reservationPersistence.getFlightIdFk()); > [javac] =20 > ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:39: > setRegistrationUtc(java.sql.Timestamp) in > airline.web.struts.ReservationForm cannot be applied to > (java.util.Date) > [javac] =20 > reservationForm.setRegistrationUtc(reservationPersistence.getRegistration= Utc()); > [javac] ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:67: > setDepartureUtc(java.sql.Timestamp) in > airline.web.struts.FlightForm > cannot be applied to (java.util.Date) > [javac] =20 > flightForm.setDepartureUtc(flightPersistence.getDepartureUtc()); > [javac] ^ > [javac] > /home/gcg/middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorU= til.java:68: > setArrivalUtc(java.sql.Timestamp) in airline.web.struts.FlightForm > cannot be applied to (java.util.Date) > [javac] =20 > flightForm.setArrivalUtc(flightPersistence.getArrivalUtc()); > [javac] ^ > [javac] 9 errors >=20 >=20 > Looking at the first error in the code, it appears that the > generated > value object isn't using the generated composite key object: >=20 > here is what is generated: >=20 > from > middlegen-2.1/samples/build/gen-src/airline/adapter/TranslatorUtil.java: >=20 > /** > * 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 > =20 > reservationPersistence.setReservationId(reservationForm.getReservationId(= )); > =20 > reservationPersistence.setPersonIdFk(reservationForm.getPersonIdFk()); > =20 > reservationPersistence.setFlightIdFk(reservationForm.getFlightIdFk()); > =20 > reservationPersistence.setRegistrationUtc(reservationForm.getRegistration= Utc()); > =20 > reservationPersistence.setComment(reservationForm.getComment()); > } >=20 > Instead it should probably look more like: >=20 > 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())); > =20 > =20 > reservationPersistence.setRegistrationUtc(reservationForm.getRegistration= Utc()); > =20 > reservationPersistence.setComment(reservationForm.getComment()); > }=20 >=20 > The same issue exists with the "copyPersistenceToVo" method. >=20 > Hopefully there is just some sort of configuration that I messed > up.=20 > The cmp20 version worked fine, though. >=20 > Thanks for reading this far... >=20 > -Darin >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: > 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 > Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > _______________________________________________ > middlegen-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/middlegen-user >=20 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around=20 http://mail.yahoo.com=20 ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Downl= oad it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php