vohoaiviet / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Trouble following reverse relationship of OneToOnes #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
See: http://groups.google.com/group/java-generic-
dao/browse_thread/thread/8010f6f717659c4d

Example mapping:
class Game {
  @Id
  Long id;

  @OneToOne()
  TimeSlot timeSlot;

  ...
}

class TimeSlot {
  @Id
  Long id;

  @OneToOne(mappedBy="timeSlot")
  Game game;

  ...
}

In this case, a search like
new Search(Game.class).addFilterNull("timeSlot");
works to find all games that are not assigned to time slots.

But a search like
new Search(TimeSlot.class).addFilterNull("game");
does NOT work correctly to find time slots without games.

One work-around is to use
new Search(TimeSlot.class).addFilterNull("game.timeSlot");

I also wonder if
new Search(TimeSlot.class).addFilterNull("game.id") would work, but I don't 
know.

Original issue reported on code.google.com by dwolvert on 7 Aug 2009 at 12:11

GoogleCodeExporter commented 8 years ago

Original comment by dwolvert on 7 Aug 2009 at 12:13

GoogleCodeExporter commented 8 years ago
I just tested using the following and it doesn't work:

new Search(TimeSlot.class).addFilterNull("game.id")

Original comment by yowza...@gmail.com on 7 Aug 2009 at 9:19

GoogleCodeExporter commented 8 years ago
Putting this off for the next version

Original comment by dwolvert on 20 Feb 2010 at 7:08

GoogleCodeExporter commented 8 years ago

Original comment by dwolvert on 9 Oct 2011 at 5:36

GoogleCodeExporter commented 8 years ago

Original comment by dwolvert on 15 Feb 2013 at 1:56