DTYPE Generated on ManyToMany Join? [message #642102] |
Mon, 29 November 2010 20:24 |
No real name Messages: 4 Registered: November 2010 |
Junior Member |
|
|
We have two entities, Client and User in tables D001 and D002 respectively. Neither are using InheritanceType.JOINED; they are the only objects in their respective hierarchies.
Each entity can join with the other via a @JoinTable:
In our User :
/** The clients. */
@ManyToMany
@JoinTable( name = "D003", joinColumns = { @JoinColumn( name = "SYSASSGN_USER_ID", referencedColumnName = "SYSASSGN_USER_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "CLIENT_ID", referencedColumnName = "CLIENT_ID" ) } )
protected List<Client> clients;
In our Client:
/** The users. */
@ManyToMany
@JoinTable( name = "D003", joinColumns = { @JoinColumn( name = "CLIENT_ID", referencedColumnName = "CLIENT_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "SYSASSGN_USER_ID", referencedColumnName = "SYSASSGN_USER_ID" ) } )
private List<User> users;
The tables are quite simple:
The D003 only has two columns: CLIENT_ID and SYSASSGN_USER_ID
Client table (D001) only has CLIENT_ID and CLIENT_NAME
User table (D002) has SYSASSGN_USER_ID, USER_ID, USER_NAME, TITLE
The SQL generated includes a column called DTYPE in the query:
SELECT t1.CLIENT_ID, t1.DTYPE, t1.CLIENT_NAME FROM D003 t0, D001 t1 WHERE ((t0.SYSASSGN_USER_ID = ?) AND (t1.CLIENT_ID = t0.CLIENT_ID))
It is looking for a value in this column on the D001 - however since @Inheritance is neither JOINED nor SINGLE_TABLE, DTYPE should not be required as a column on the table.
Any assistance is appreciated; we have tried a number of different approaches but none have worked to date.
Thanks,
Mike
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04032 seconds