• 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

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

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
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

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 ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Texugo",
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic