Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Eclipselink unidirectional mapping  RSS feed

Aprajita Paul Choudhury
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table Student(ID integer PRIMARY KEY,Student name varchar(55),subj_ID INTEGER,CONSTRAINT Stud_FK1 FOREIGN KEY (subj_ID) REFERENCES Subject(ID)); and another table subject(ID integer PRIMARY KEY,Subject varchar(55))
ID in the Sudent and Subject table are generated by sequence defined in DB

In my Student entity class i have define
//uni-directional many-to-one association to Subject
private Subject sub;
From the UI i am getting the Student name and subject Name.While am trying to persists the Student,its trying to add a new row in Subject class.But I dont want to add a new row for Subject table and only want that a respective ID for Subject table should be stored in Student table for the selected subject name.
I am new to eclipselink,could anyone suggest how i can join these two tables.
All examples that I see is having a Subject entity having a list of Student anf for each new Subject,list of students are saved in DB.But my requirement is,without adding a new Subject I want to add a Student details.
Thanks in advance.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!