Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36940

Re: no easy way to do a reverse pointer?

Newsgroups comp.lang.java.programmer
Date 2017-07-14 14:32 -0700
References <6c91c2b4-7d8f-42ba-8a51-eaef43635f49@googlegroups.com> <ojooib$v3s$1@dont-email.me> <1d4174af-ff17-433c-bb32-23e17388e9ff@googlegroups.com> <ojp0ea$7l6$1@dont-email.me>
Message-ID <ee84dcfb-e9e9-470e-ad0a-08a46908493d@googlegroups.com> (permalink)
Subject Re: no easy way to do a reverse pointer?
From lewbloch@gmail.com

Show all headers | View raw


This type of cross-reference is common in JPA, with its `@OneToMany`, `@ManyToOne`, and `@ManyToMany` relationships. These are modeled as contained collections. 

One to many is something like:

    public class Manager {
      Set<Employee> underlings;
      ...
    }

Many to one is like:

    public class Employee {
      Manager manager;
      ...
    }

Many to many:

    public class Employee {
      Set<Project> projects;
      ...
    }

    public class Project {
      Set<Employee> members;
      ...
    }

It's a pretty standard, long-standing, and well documented approach.

--
Lew

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

no easy way to do a reverse pointer? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 11:56 -0700
  Re: no easy way to do a reverse pointer? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-07 19:48 +0000
    Re: no easy way to do a reverse pointer? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 13:28 -0700
      Re: no easy way to do a reverse pointer? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-07 21:47 +0000
      Re: no easy way to do a reverse pointer? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 18:06 -0400
        Re: no easy way to do a reverse pointer? lewbloch@gmail.com - 2017-07-14 14:32 -0700

csiph-web