Results 1 to 3 of 3
  1. #1
    Ed
    Ed is offline Senior Member
    Join Date
    Jun 2007
    Posts
    110
    Rep Power
    0

    Default problems with JPA

    I have an entity named Employee
    the employee has a name, and a collection of "superiors" and collection of "subordinates"
    I have 2 tables:
    table A= where I save the id and the name
    table B= where I save the id, one to the subordinate and the other to the superior

    So, If I have an user named "John" and other named "Mary"
    I do something like that
    john.setSuperior(Mary) that is to say that john is Mary's subordinate

    the tables have a many to many relationship

    when I search "john" y do "getSuperiors()" and it returns to me
    Mary
    but If I do mary.getSubordinates() it doesn't return to me nothing.
    What is the problem?

  2. #2
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    8

    Default

    Can you paste the code of the setSuperior method?
    I guess that there is the problem, the insertion.

  3. #3
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Posts
    130
    Rep Power
    0

    Default

    when you do: "john.SetSuperior(mary)" in data base you have to insert mary as john's superior (it seems that works) and also you have to insert john as mary's subordinates.
    The problem is your data base, the update, insertion, and then.
    if you want send the code, and I'll check it

Similar Threads

  1. Problems in JSP : Need help
    By raj4u in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-07-2008, 10:06 AM
  2. GUI problems.
    By saytri in forum New To Java
    Replies: 1
    Last Post: 12-16-2007, 10:27 PM
  3. gui problems
    By bluebirdjc in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 05:38 PM
  4. a few problems
    By gary in forum AWT / Swing
    Replies: 0
    Last Post: 07-11-2007, 04:57 PM
  5. Problems with the jar
    By Freddie in forum NetBeans
    Replies: 2
    Last Post: 05-29-2007, 03:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •