Here is the annotation for a many to many association:
@ManyToMany(fetch=FetchType.LAZY) @JoinTable(name="USER_ROLE_MAPPING", schema="$QUALITY", catalog="METTEST", joinColumns = { @JoinColumn(name="USERID", nullable=false, updatable=false) }, inverseJoinColumns = { @JoinColumn(name="ROLEID", nullable=false, updatable=false) }) public List getRoles() { return this.roles; }
This results in the following SQL that is missing the schema for the join table:
select u.ID c0 , ur.ID c1, ur.ROLE c2, ur.DESCRIPTION c3 from METTEST.$QUALITY.USER uleft outer join USER_ROLE_MAPPING urz_ on urz_.USERID = u.ID left outer join METTEST.$QUALITY.ROLE ur on ur.ID = urz_.ROLEID where u.ID = ? order by u.ID
Fixed in HEAD.
Note that this excludes DDL generation across schema's which is not supported at this time.
As a workaround the table name can be fully qualified as catalog.schema.tablename