openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <da...@6degrees.com>
Subject Implications of no mappedBy element
Date Tue, 06 Jul 2010 16:11:12 GMT
Hello, I have the following mappings in User and Role classes:

*** User.validRoles

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "userroles",
joinColumns = { @JoinColumn(name = "userid", referencedColumnName =
"userid") },
inverseJoinColumns = { @JoinColumn(name = "roleid", referencedColumnName =
"roleid") }
)
private List<Role> validRoles = new ArrayList<Role>(0);

*** Role.validUsers

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "userroles",
joinColumns = { @JoinColumn(name = "roleid", referencedColumnName =
"roleid") },
inverseJoinColumns = { @JoinColumn(name = "userid", referencedColumnName =
"userid") }
)
private List<User> validUsers = new ArrayList<User>(0);

***

On page 98 of "Pro JPA 2" the author states "Note that no matter which side
is designated as the owner, the other side should include the 'mappedBy'
element; otherwise, the provider will think that both sides are the owner
and that the mappings are separate unidirectional relationships."

With OpenJPA (1.2.1) as the provider, what are the implications of my
mapping (not using mappedBy)? I've had the above mapping in place for a year
or more with no problems that I can see (I am not using L2 cache).

Thanks.


-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:daryl.stultz@opentempo.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message