• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Beginner needs help with updating PK

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
touche
shame i have wasted 2 days on that issue
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic