Win a copy of Spark in Action this week in the Open Source Projects 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Deleting a record from one table deletes record from another table too

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two tables, Employee and Supervisor. I am using Spring JDBC for my database actions and MySQL as my database. I don't have any relation between an Employee and Supervisor. But as part of the front end web application, I can assign a supervisor to an employee. So, after doing that, when I try to delete a supervisor who has an employee assigned, the action deletes all employees whether they have that supervisor assigned to them or not. I don't understand what's happening. Here is my spring-config.xml:
<bean id="MYSQL_DATASOURCE" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/employeereview" />
<property name="username" value="root" />
<property name="password" value="sharmav0416" />
<!-- Configure DAO -->
<bean id="SUPERVISOR_DAO" class="employeereview.supervisor.dao.SupervisorDAOImpl">
<property name="dataSource">
<ref bean="MYSQL_DATASOURCE"></ref>
<bean id="EMPLOYEE_DAO" class="employeereview.employee.dao.EmployeeDAOImpl">
<property name="dataSource">
<ref bean="MYSQL_DATASOURCE"></ref>
<!-- Configure Business Service -->
<property name="dao">
<ref bean="SUPERVISOR_DAO"></ref>
<property name="dao">
<ref bean="EMPLOYEE_DAO"></ref>

Any help would be greatly appreciated.


She's brilliant. She can see what can be and is not limited to what is. And she knows this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic