Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Even though id is same records are getting inserted in few table instead of update.

Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi i have bellow listed table.

Root table Customer, license (customer to license one to one relationship), product (license to product one to many relationship), module (product to module one to many relationship). i have few other master table for product and module. which i am not describing in this example for simplification.

Now when i tried to update the record. one new customer is getting inserted.

So basically i have one record for one customer, one license record which is associated with customer. one product record which is associated with license. and 2 modules records which is associated with product.
now when i tried to insert 3rd module for the same customer.

I can see one new customer entry in my customer table. where as license and product able are perfactly fine.

Bellow are some SQL statement which hibernate has printed on my console.

I have also printed the customer id from the customer object before i call the hibernate's saveOrUpdate() method

Bellow is my code for update/insert

Log file

Can anybody help me out please ??/
    Bookmark Topic Watch Topic
  • New Topic