Identity columns and CMP's
1 posts in topic
Flat View  Flat View

Posted By:   Gerald_Holmann
Posted On:   Saturday, November 24, 2001 05:05 PM

Can I use a CMP to map to a table with an identity column when this column is the primary key?

When the create method is called in the CMP, I need it to create the row without including the identity column in the INSERT statement, and then somehow retrieve the value of the newly generated id.

This seems like it should be a standard feature of EJB's, but I have looked everywhere I know of and have not been able to find an answer!

Re: Identity columns and CMP's

Posted By:   AlessandroA_Garbagnati  
Posted On:   Sunday, November 25, 2001 07:47 AM


I don't think that handling Identity columns has to be a standard feature of EJB, considering that is not a standard database feature, and not all databases support it, making the application not very portable.

Unfortunately I don't think you can solve the problem with a CMP Bean, and you probably have to use a BMP.

If you want to consider it, you can use a different, more portable, solution using bean generated primary key. There are interesting links in some FAQs and Forum threads.

About | Sitemap | Contact