File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Eclipselink unidirectional mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Eclipselink unidirectional mapping" Watch "Eclipselink unidirectional mapping" New topic

Eclipselink unidirectional mapping

Aprajita Paul Choudhury

Joined: Jan 04, 2014
Posts: 1
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.
I agree. Here's the link:
subject: Eclipselink unidirectional mapping
jQuery in Action, 3rd edition