File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Meet-in-the-middle mapping question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Meet-in-the-middle mapping question" Watch "Meet-in-the-middle mapping question" New topic
Author

Meet-in-the-middle mapping question

Tomor Pupovci
Greenhorn

Joined: Oct 18, 2009
Posts: 1
Hi,
This is my db schema which looks like this:



So a staff (which is a teacher) can teach a specific subject (curriculum) to a specific class (class_id).

As you can see 'teaches' is the table where all the tables meet. I've tried the Dali tool and it did a pretty good job, by producing something like this (The 'Staff' entity, not entirely quoted, just the parts which have to do with 'teaches'):



But this makes problem when I want to persist a new Staff object, which 'teaches' a specific subject (year, class, subject_id) to a specific class_id, because it doesn't know which class_id with which subject go together. Could you please help me with a better solution for this?

Help is appreciated

Thanks in advance,
tomor
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Meet-in-the-middle mapping question
 
Similar Threads
ManyToMany & fields of association table
Need help for Many to Many association
ManyToMany & fields of association table
Hibernate - Annotations - many to many association
Confused with many to many,