Announcement Announcement Module
Collapse
No announcement yet.
Help! Having difficulty with Data Access in persistense. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! Having difficulty with Data Access in persistense.

    Hi there! Been stuck for a few hours now hoping someone could be of assistance.
    Let's say I have a

    TABLE A
    ID (FK references to PK of TABLE AB)
    NAME
    DESCRIPTION

    AND TABLE AB
    ID(PK)
    DESCRIPTION

    I created an entity bean that maps the values of Table A

    so
    @Entity
    @Table (name="TABLE A")
    ...
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public int getId() {
    return id;
    }

    My problem is this. Table A may have 2 IDENTICAL IDs since it is only FK so

    1, name_1, hello
    1, name_2, hello

    but whenever i retrieve their values its always
    1, name_1, hello
    1, name_1, hello

    whenever I execute this
    hibernateTemplate.find("from TABLEAClass ");

    how do i get
    1, name_1, hello
    1, name_2, hello?

    Any help would greatly be appreciated.
Working...
X