Forums Register Login

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

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
"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.
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4188 times.
Similar Threads
Hibernate- one-to-many association on a foreign key
If somebody can translate this for me please?
1-to-M mapping confusion
Can't not instance class...
ORA-00001: unique constraint exception
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:02:59.