cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to modify a primary key?

former_member186148
Active Participant
0 Kudos

Hello SDN!

I need to modify primary keys that doesn't generate automatically but entered by user. Is there a way to it?

I'm working with EJB.

(PS: I know that modifying a PK is not recommended in relational database theory.)

Thanks

Lev

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I think you have to make the changes manually by using SQL statements.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Lev

You can modify the Primary Key [but it is not suggestible as you mentioned], as far as there are no duplications,not null in the primary key column

Regards

Chaitanya.A

former_member186148
Active Participant
0 Kudos

Hi Chaitanya!

When I call a setter for Primary Key, I've got an exception

"Cannot modify a primary key field."

I'm working with CMP beans

Former Member
0 Kudos

Hi Lev

<a href="http://download-west.oracle.com/docs/cd/B12314_01/web.904/b10324/cmp.htm">Look into this link for more Info</a>

Warm Regards

Chaitanya.A

Former Member
0 Kudos

Container Managed Persistence will not allow you to modify the primary key.

You have to use BMP if your design allows.

try to have a programmatic work around for this problem.