[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] Problems with ManyToOne and OneToMany
|
- From: Johannes Michler <orgler@xxxxxxxxx>
- Date: Sun, 12 Jul 2009 13:19:12 +0200
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=6iTe5VvN2E/c+KQsz4/PTmQbSOrrY0tgtKyv9jlLBpQ=; b=Qv7Q2wgUIo7vxxqKlA+GqYZlpCUDMdNhwJuUcmEgo7+U+bIGnw4s2x6172mrDf1IOl +lZzCAJbMMrW/aBXD8QoLw6gGk3eauD06tSJ7uaTWAv7XzfTK7NRAOZ0DjI6X7kKFTS8 80GfQpgYti6ykgDWkhHtNJksYhwphBNl+4wZ8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QP/q7YVmbW2DSgEq0vtYOxZ062AcQiPfI2d8yb/xgrL6QHjpavipn6oCEV/44ajtsQ IUFQMeMZwDIjT24tb3GiCGGmyytOf5hW+ylPUw3cpsZzNED+vn8Bz2hJ3zj+RtR/wMgr g0Fr4vVYQ+gSQeBXd5tpQXGbcpfvWqAdwrJWo=
Hi,
I'm using eclipselink to do some persistence. I'm having the following classes/tables:
@Entity
public class Team{
@OneToMany(mappedBy="team")
public Set<Player> players;
}
@Entity
public class Player{
@ManyToOne
public Team team;
}
In my database there is a table team and a table player (with a foreign-key-relationship to a team-ID).
This works as far as I'm not deleting anything. But when calling em.remove(myPlayer) the "players"-Set in "Team" is not automatically updated. When closing my application and restarting it, everything works fine. But without this restart the "players"-array seems to get cached somewhere.
Any idea on how to solve this? From time to time I'm getting errors that there are unpersistet instances after such a remove operation. For hibernate, I've read something about an "inverse"-annotation which could (if I understood it right) solve such a problem.
Any help would be highly appreciated,
best regards
-Johannes