Cascade Issue

Ads

 
 

Share on Google+Share on Google+

/
Cascade Issue
0 Answer(s)      5 years and 11 months ago
Posted in : Hibernate

I have 3 tables: user, stuffperuser (pk: FKuser & FKstuff), stuff. When I don't use cascading, I get an error: "Cannot add or update a child row: a foreign key constraint fails"

The mapping files are correct. I need some sort of cascading. It works when I add cascading in the set property of the many-to-many relationship to add non-existent data to user & stuff, but its overwriting data in stuffperuser. Whenever I save an object which contains a 'stuff' which was already entered in stuffperuser, it overwrites the row, even when the other part of the PK is not thesame user. So basicly the previous user with that 'stuff' is overwritten by the new user with the same stuff.

It should always add a new row in the table stuffperuser if it is a new user, even with stuff that is already entered by another user.

That is not something that I want, but I can't seem to sort out where (stuff or user) to put the cascade rule and which one. The property inverse is set to FALSE.

I've looked up different sources, such as the offical hibernate website. I understand how cascading works with 2 tables, but with hibernating and 3 tables while the second is a normalization table, the dices role a bit different. Thanks for any input.

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Cascade Issue
Cascade Issue  I have 3 tables: user, stuffperuser (pk: FKuser & FKstuff), stuff. When I don't use cascading, I get an error: "Cannot add... want, but I can't seem to sort out where (stuff or user) to put the cascade rule
issue on jcombobox
issue on jcombobox  i have JTextfield and JComboBox. there are several values in combobox.when i select a value from combobox how to make textfiled as a combobox.only few values in the combobox need this functionality. need
Advertisements
jdialogbox issue.
jdialogbox issue.  i have one button.when clicked on it has to show a dialog box.but even click on it several times it has to open dialog box only once. if it is already not opened atleast once,then only it has to open dialog
JTABLE Issue
to go back for another search. Now issue is -- when I put some input data
Issue with Javascript
Issue with Javascript  Hi I created arrays in javascript in following way var myimages= new Array(); myimages[0]="iphone_pushups.png"; myimages[1]= "cricket.png"; myimages[2]= "july.png"; myimages[3]= "matrix.png
Decimal Format Issue Java
Decimal Format Issue Java  Decimal Format Issue Java
Use of CASCADE CONSTRAINTS
Use of CASCADE CONSTRAINTS  hii, What is the use of CASCADE CONSTRAINTS?   hello,, CASCADE CONSTRAINTS describes about the parent-child relationship between tables
semantic issue xcode 4.2
semantic issue xcode 4.2  I have updated xcode 4.0 to 4.2 .. but once i open any application in this new version of xcode ..it throws lots of semantic issue. Can anyone please explain why it occurs and how to resolve
What is the use of CASCADE CONSTRAINTS?
What is the use of CASCADE CONSTRAINTS?   What is the use of CASCADE CONSTRAINTS?   Hi, The CASCADE CONSTRAINTS clause drops all referencial integrity constraints that refer to the primary and unique keys defined
Resultset Issue in SQL
Resultset Issue in SQL  when i call rs.next() in my code it is returning false, though im having valid query to execute and fetch a row from database.how can i resolve this issue. My code is: SELECT JOBDESCRIPTION,CATEGORY
Reloading issue in jsp
Reloading issue in jsp  I wrote one jsp page with one submit button. If we click on button it will execute business logic, but I want to stop reloading page if user refreshed the link. how we do
Issue in JSF and Richfaces.
Issue in JSF and Richfaces.  Hi,I am with a issue in JSF and Richfaces.I have one add user page.In which i have fields Firstname,LastName,SecretID(which has Validate/suggest as links beside tat) ,Email address,city,state,country
Login issue using Servlet
Login issue using Servlet  Hi all, I need a code for login using servlet where in I want to check and validate user name and password from database also I want to check candidate's class (for ex. FY, SY, TY) if candidate's class
Grid rows delete issue
on onchange of dropdown then because of rows indexing issue,they can't get middle row
Read Issue itext
Read Issue itext  Hello, I m using itext to read data from pdf file.. Right now i m reading page wise data,but i want to extract data on each line In variable whole page data there... so i want to read data line by line so
Read Issue itext
Read Issue itext  Hello, I m using itext to read data from pdf file.. Right now i m reading page wise data,but i want to extract data on each line In variable whole page data there... so i want to read data line by line so
maven subversion issue
maven subversion issue   m doing work on maven and subversion i have created a maven project now i want to point it to my repository(created by svn tortoise) i read that for this i have to change in pom.xml file from this site
jquery issue plese help
jquery issue plese help  Im am trying to Change the background color of the dashboard to black with an opacity of 0.6 Change the opacity of the images in the dashboard to 0.5 before the dashboard slides out. Change the opacity
Version of com.paypal>cascade-akka_2.10 dependency
List of Version of com.paypal>cascade-akka_2.10 dependency
Version of com.paypal>cascade-akka_2.11 dependency
List of Version of com.paypal>cascade-akka_2.11 dependency
Version of com.paypal>cascade-common_2.10 dependency
List of Version of com.paypal>cascade-common_2.10 dependency
Version of com.paypal>cascade-common_2.11 dependency
List of Version of com.paypal>cascade-common_2.11 dependency
Version of com.paypal>cascade-examples_2.10 dependency
List of Version of com.paypal>cascade-examples_2.10 dependency
Version of com.paypal>cascade-examples_2.11 dependency
List of Version of com.paypal>cascade-examples_2.11 dependency
Version of com.paypal>cascade-http_2.10 dependency
List of Version of com.paypal>cascade-http_2.10 dependency
Version of com.paypal>cascade-http_2.11 dependency
List of Version of com.paypal>cascade-http_2.11 dependency
Version of com.paypal>cascade-json_2.10 dependency
List of Version of com.paypal>cascade-json_2.10 dependency
Version of com.paypal>cascade-json_2.11 dependency
List of Version of com.paypal>cascade-json_2.11 dependency
Initializing Integer Variable issue?
Initializing Integer Variable issue?  My program is supposed to take a phrase like you'd see on a TV commercial, for example: "Call 1-800-GETLOAN now to..." then take that phrase and convert it to its actual phone number. My
Solving java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean issue
Solving java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean issue  Solving java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean issue In my Spring
Issue in Stateless session bean example
Issue in Stateless session bean example  Hi Team, I tried your Stateless session bean example in the path http://www.roseindia.net/ejb/examples... the issue. $Proxy65 cannot be cast

Ads

 
Advertisement null

Ads