Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic