[jbosstools-issues] [JBoss JIRA] (JBIDE-26458) Import Entities from DB with ManyToMany relationships doesn't manage mappedBy

Jeff MAURY (Jira) issues at jboss.org
Wed Sep 25 06:31:07 EDT 2019


     [ https://issues.jboss.org/browse/JBIDE-26458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff MAURY updated JBIDE-26458:
-------------------------------
    Fix Version/s: 4.13.0.Final
                       (was: 4.13.0.AM1)


> Import Entities from DB with ManyToMany relationships doesn't manage mappedBy
> -----------------------------------------------------------------------------
>
>                 Key: JBIDE-26458
>                 URL: https://issues.jboss.org/browse/JBIDE-26458
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: hibernate
>    Affects Versions: 4.6.0.Final
>         Environment: Eclipse: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200
> DBMS: Sql Anywhere 17.0.9.4857
> Annotations jdk 1.5+
> Hibernate Version 5.2
>            Reporter: Matteo Barrese
>            Assignee: Koen Aers
>            Priority: Major
>             Fix For: 4.13.0.Final
>
>
> Import from entities tool does not correctly handle the bidirectional ManyToMany relationships because in some cases it does not define mappedBy on one side.
> example:
> {code:java}
> public class SecGroup implements java.io.Serializable {
> ....
> 	@ManyToMany(fetch = FetchType.LAZY)
> 	@JoinTable(name = "SecGroupUser", schema = "dbm", joinColumns = {
> 			@JoinColumn(name = "GroupId", nullable = false, updatable = false) }, inverseJoinColumns = {
> 					@JoinColumn(name = "UserId", nullable = false, updatable = false) })
> 	public Set<SsUsers> getSsUserses() {
> 		return this.ssUserses;
> 	}
> ....
> }
> public class SsUsers implements java.io.Serializable {
> ...
> 	@ManyToMany(fetch = FetchType.LAZY)
> 	@JoinTable(name = "SecGroupUser", schema = "dbm", joinColumns = {
> 			@JoinColumn(name = "UserId", nullable = false, updatable = false) }, inverseJoinColumns = {
> 					@JoinColumn(name = "GroupId", nullable = false, updatable = false) })
> 	public Set<SecGroup> getSecGroups() {
> 		return this.secGroups;
> 	}
> ...
> }
> {code}
> It must be for example
> {code:java}
> public class SecGroup implements java.io.Serializable {
> ....
> 	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "secGroups")
> 	public Set<SsUsers> getSsUserses() {
> 		return this.ssUserses;
> 	}
> ....
> }
> public class SsUsers implements java.io.Serializable {
> ...
> 	@ManyToMany(fetch = FetchType.LAZY)
> 	@JoinTable(name = "SecGroupUser", schema = "dbm", joinColumns = {
> 			@JoinColumn(name = "UserId", nullable = false, updatable = false) }, inverseJoinColumns = {
> 					@JoinColumn(name = "GroupId", nullable = false, updatable = false) })
> 	public Set<SecGroup> getSecGroups() {
> 		return this.secGroups;
> 	}
> ...
> }
> {code}



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jbosstools-issues mailing list