insert into two tables - (CMP with PK auto generated )
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Laleendra_Pethiyagoda
Posted On:   Tuesday, May 25, 2004 05:20 AM

Hello there. Here is my query Im using struts with ejbs. My datasource is MYSQL. My app server is JBOSS 3.2.1 I have set it up successfully for CMP. There are two tables that Im concerned with. 1. Customer 2. Credit card One custome4r may have many Credit cards so, in credit card table , there is a FK reference to C_ID (customer ID) I have CMR Accessor methods in Customer EJB. (public Collection getCards() and setCards()) I have set up MYSQL to auto generate Primary keys. My question is ... How does JBOSS manage inserting the relevant Foreign key id (i.e CreditCard.C_ID) when I insert customer detail   More>>


Hello there. Here is my query

Im using struts with ejbs. My datasource is MYSQL.

My app server is JBOSS 3.2.1

I have set it up successfully for CMP.

There are two tables that Im concerned with.

1. Customer

2. Credit card

One custome4r may have many Credit cards

so, in credit card table , there is a FK reference to C_ID (customer ID)

I have CMR Accessor methods in Customer EJB. (public Collection getCards() and setCards())

I have set up MYSQL to auto generate Primary keys.

My question is ...

How does JBOSS manage inserting the relevant Foreign key id (i.e CreditCard.C_ID) when I insert customer details and credit card details.

The situation arises when a new customer needs to sign on with their personal details (that go in to thecutomer table)

and credit card details (that go in to CC table at the same time)

Please help

   <<Less

Re: insert into two tables - (CMP with PK auto generated )

Posted By:   Ash_H  
Posted On:   Wednesday, May 26, 2004 10:13 PM

Hi,


You might find this link helpful

http://forum.java.sun.com/thread.jsp?forum=13&thread=319184


Ash

Re: insert into two tables - (CMP with PK auto generated )

Posted By:   Ash_H  
Posted On:   Tuesday, May 25, 2004 09:55 PM

Hi,



Is the primary key == customer_ID here?



Ash

About | Sitemap | Contact