The PK
for a CMP bean doesn't have to be a real PK marked field. You may get away with
it by creating a PK with ALL FIELDS in the table(provided that the table doesn't
store duplicate records). Otherwise, you're stuck with JDBC.
HTH,
Juan Pablo Lorandi
Chief Software
Architect
Code Foundry Ltd.
Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050 Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com
Disclaimer:
Opinions expressed are entirely
personal and bear no relevance to opinions held by my employer.
Code Foundry Ltd.'s opinion is that I
should get back to work.
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Karr, David
Sent: Thursday, October 03, 2002 7:30 PM
To: [EMAIL PROTECTED]
Subject: Re: EJB ( CMP) and Primary KeysBy your question, I believe you might not understand exactly what happens in a session bean. In a CMP entity bean, you don't control any business logic, you let the container do it. In a session bean, you do whatever you need to do. In your case, you will get your datasource, and then you will manually build your prepared statements and run your queries. If you know what you need to get out of the table, then build the query for it.-----Original Message-----
From: Maya menon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 11:01 AM
To: Karr, David; [EMAIL PROTECTED]
Subject: Re: EJB ( CMP) and Primary KeysDavid,
yes you r right, the data model already exists and its not possible to change it right now, its a nightmare.
And, Yes, the table doesnt have a primary key also..
Now, mapping to the session bean:
My requirement is to take 6 results from 3 tables and do another query based on these 6 results. Out of these 6 results, 2 are from this table with no PK. The otehr two tables, I believe are having PKs. But this table has a foreign key relationship also...
What do you suggest ?
Thanks
"Karr, David" <[EMAIL PROTECTED]>wrote:
> -----Original Message-----
> From: Maya Menon [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 03, 2002 8:51 AM
> To: [EMAIL PROTECTED]
> Subject: EJB ( CMP) and Primary Keys
>
> I have to create a CMP for a table with no primary key but which has
> a foreign key. Has any one done this ? I am using Websphere and
> WSAD..
> If anyone has done this ... can someone help me. I am confused in
> creating an EJB for a table with NO primary key..
>
> I got an answer from a group saying , create a pseudo pK, But
> I am not sure how to do that..
I have a feeling you're dealing with an EXISTING table, and you have to map
that to a CMP entity EJB. Any suggestions about creating opaque primary key
values probably won't help you here.
This table really does NOT have a primary key?
I have a feeling you might need to map this to an EJB session bean and have
it do the work. I don't see how to define an EJB entity that does not have
a primary key.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!