Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

hbm.xml file does an update instead of an insert- Helppppp

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I really need help on this. I am trying to use Hibernate to insert on two table on the database. The relation is of type Parent/Child. The problem is that it inserts well on the Parent table but on the Child table it doesn't insert.

Debuging through the project I've found out that he makes an INSERT for the first table but for the second table it makes an UPDATE.

The hbm.xml files that I've built are bellow, the first file has lot of thing but what is used for these tables is at the end:

The precious hbm.xml file has a joined-class that works fine and has a set for a collection that is doing an update instead of an INSERT.

The class that is used in the set implements the following hbm.xml file.

Here is the SQL statements that are produced by the hbm.xml files

I really need answers for:

How can I force the hbm.xml file to do an INSERT instead of an UPDATE?

Thanks for any reply

Many Thanks,
Rui F�lix
Rui Felix
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I already got the answer for my question. I had to make some changes to the TslMultiBuyListImpl.hbm.xml file. Here are the two hbm files:

I also had to set the class from the second hbm file implementing Serializable.

Many Thanks
Rui Felix
[ October 30, 2007: Message edited by: Texugo ]
Posts: 17346
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic