IntelliJ Java IDE
The moose likes Object Relational Mapping and the fly likes one To one mapping through third table. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "one To one mapping through third table." Watch "one To one mapping through third table." New topic
Author

one To one mapping through third table.

ambar patil
Ranch Hand

Joined: Nov 29, 2005
Posts: 226
Is it possible to have one to one relationship like these(in many to many way):
class A{

@oneToOne
BRef bref;

}

class Bref{

A a

B b

@oneToOne
getA()..

@oneToOne
getB()..
}

class B{
}
?
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
Sure. It is not like a many-to-many, though. It is still a one-to-one. All you are doing is adding a level of indirection between A and B.


-Mike
Pro JPA 2: Mastering the Java Persistence API
 
 
subject: one To one mapping through third table.
 
Threads others viewed
Help understanding when to use em.find and query manager and their ability to fetch nested objects
Hibernate second query
runtime exception
problem creating a foreignkey relation in compositekeys
Casting Problem
IntelliJ Java IDE