It sounds like in you scenario you are relying on CMP for part of your
persistence and sort of relying on BMP for your dependent objects. I don't
think slicing and dicing this way is advisable. Your solution will not be
very portable. Why not use BMP across the board, that way you can make sure
to get the same JDBC connection for all the persistence IO within a
transaction?

-Chris.


> -----Original Message-----
> From: Bill Siggelkow [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, September 28, 1999 4:03 PM
> To:   [EMAIL PROTECTED]
> Subject:      DB Helper classes for dependent data
>
> I have a stateful session bean that wraps a CMP entity bean for
> persistence
> services.  In the session beans 'save()' method it creates the CMP entity
> bean and then creates some dependent data using a "helper class".  The
> "helper class" provides data access to a table containing dependent data
> for the CMP bean.  There is a foreign key constraint between the table
> holding the dependent data and the OID of the CMP bean.  The helper class
> is not an entity bean but simply gets a connection and inserts data into
> the table using JDBC.  The problem I am having is that when I attempt to
> insert the dependent data into the table I get a constraint violation --
> at
> first this seemed impossible since I create the CMP bean first ...
> however,
> I realized that the problem is that the creation of the dependent data is
> using the same connection as the CMP bean.  If I remove the constraint
> everything works fine ...
> Is there a way of getting the connection being used by the CMP bean?  Is
> there a better approach to this problem other than (1) converting the CMP
> bean to BMP, or (2) removing the database constraint, or (3) making the
> dependent data a full-blown entity bean?
>
> Bill Siggelkow
> Senior Software Engineer
> Syndesa, Inc.
> http://www.syndesa.com
>
> ==========================================================================
> =
> 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".
>
> ==========================================================================
> =
> 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".

===========================================================================
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".

Reply via email to