----- Original Message -----
From: Eivind Waaler <[EMAIL PROTECTED]>
Date: Thursday, October 3, 2002 9:52 am
Subject: [Middlegen-user] RE: Double PK field trouble with EJB CMP2.0
composite PK in CMR/CMP clash
> Allright, I've deployed the airline sample on Weblogic 7.0, SQL Server
> 8. Seems like we actually get the same problem there. I added the
> following code to the InsertReservationAction:
>
> PersonLocal personLocal = ...
> FlightLocal flightLocal = ...
>
> ReservationLocal reservation = ReservationUtil.getLocalHome().create(
> reservationForm.getRegistrationUtc(),
> reservationForm.getComment(),
> personLocal,
> flightLocal
> );
>
> Testing of this on Weblogic ends in the following:
>
> <03.okt.02 10:29:17 CEST> <Error> <HTTP> <101046>
> <[ServletContext(id=3401671,name=airline-web.war,context-
> pathActionServlet: Create error
> javax.ejb.CreateException: In EJB Reservation, primary key field
> 'flightIdFk' was not set during ejbCreate. All primary key fields
> must be
> initialized during ejbCreate.
> at
> airline.ejb.ReservationCMP_1qdy24__WebLogic_CMP_RDBMS.pkCheck
(ReservationCMP_1qdy24__WebLogic_CMP_RDBMS.java:2207)
> at
> airline.ejb.ReservationCMP_1qdy24__WebLogic_CMP_RDBMS.ejbCreate
(ReservationCMP_1qdy24__WebLogic_CMP_RDBMS.java:2259)
> at java.lang.reflect.Method.invoke(Native Method)
> at weblogic.ejb20.manager.DBManager.create(DBManager.java:737)
> at
> weblogic.ejb20.manager.DBManager.localCreate(DBManager.java:716)
> at
> weblogic.ejb20.internal.EntityEJBLocalHome.create
(EntityEJBLocalHome.java:182)
> at
> airline.ejb.ReservationCMP_1qdy24_LocalHomeImpl.create
(ReservationCMP_1qdy24_LocalHomeImpl.java:97)
> ...
>
> I'm sure we had this bean working som months ago on the cvs
> version of
> middlegen at the time. That was however WLS6.1 I used back then.
>
> Is this a Middlegen problem, xdoclet problem or weblogic 7.0
> problem?? Anyone got it working? I just can't see what's wrong
> with this
> bean...
>
I don't know what the EJB spec says about this. Anyone? It's definitely
not an XDoclet problem. It's a WLS problem, but maybe Middlegen can
work around it?
What if the ejbCreate methods that take CMR/CMP fields as this example
does the following:
ejbCreate(..., PersonLocal person, ...) {
setPersonIdFk( person.getPersonId() );
}
-in addition to or in stead of calling the CMR setter in ejbPostCreate
()? Eivind, can you try that?
I don't know if JBoss or other containers would like this, so maybe
we're facing app-server-specific java code here. We should try to avoid
that, but if it's the only solution, let's go for it.
/Aslak
> .eivind
>
> snippysnippy
> >
> > So it's *exactly* like the airline sample, then. Did you look
> at that?
>
> Yes, it probably is very much like the airline example. I've
> discussedthis
> with Eivind today, and we figured out it would probably be a
> good idea
> to
> try to deploy the airline app to weblogic, and see if the problem
> reincarnates there. Placed on personal TODO list, though.
>
> >
> >> Result is that entity bean for B gets FK/PK fields acting both
> as CMR
> and CMP fields. Rules are approx. as follows: 1) a CMR field is
> snip snip snip>
>
> > Create A and C first and then create B ;-)
> > -or ask on http://newsgroups.bea.com/
>
> This is actually what is done, and it has been verified that A
> and C both
> are assigned valid id's from autogenerator, so the problem is
> that the
> ids
> (PK's) are never transferred to the PK fields of the PK class of
> bean C,
> probably due to the CMR/CMP confusion.
>
> However, I got around the problem by giving the B table its own
> autonumber
> PK, though conceptually not neccessary. As a consequence, my ORM
> model is
> somewhat messed up. I can live with that for now, though.
>
>
>
> Regards,
>
>
> Kristoffer Moe
> Senior Consultant
> Elan It ReSource
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> middlegen-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
middlegen-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/middlegen-user