• Post Reply Bookmark Topic Watch Topic
  • New Topic

Beginner needs help with updating PK

 
Robert Tomson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i am complete beginner if it comes to JPA/EJB so i dont know, if i will be able to explain myself correctly but here we go:

here is my database


and two automatically generated by netBeans classes (based on that database)




and in the third class UserDAOBean i am doing createUser updateUser deleteUser ... etc.
i am able to successfully persist() or remove() user but i can not update(merge ?) username(PK)



any ideas ?
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update the PK? Is that really what you want to do?

I'm wondering if it's not simply impossible to 'update' a primary key. Maybe delete a record and create a new one based on the original data, but updating a primary key? That's not really a good idea, is it?

Can you even do it using on your DB using direct SQL? Give it a try!

-Cameron McKenzie
 
Robert Tomson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
touche
shame i have wasted 2 days on that issue
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!