Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

table relationship question: help!!

 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys

i have table called Division, and Company

in the Company i have:

@OneToMany(mappedBy="company", cascade = ALL)
private List<Division> divisions = new Vector<Division>();

in the Division i have:
@ManyToOne(cascade=MERGE)
@JoinColumn(name="company_id")
private Company company;

when i create a Division i always assign a company to it, so one company could have many divisions.
i want to delete one division without deleting the company since there are still other divisions related to this company. However, it is not working.
i believe that my problem is something wrong with the cascade, but i tried and it is nor working

please help me, i have been working on it for hours

thank you
 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i solve the problem
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!