Glassfish Version: v1_ur1-p01-b02
This is almost certainly a user error, but I'm having a bit of an issue with the following query:
--[i]
Query query = em.createQuery( "SELECT ts FROM TestsetEntity ts WHERE :queue not member of ts.queues" );
query.setParameter( "queue", queue );
return query.getResultList();
[/i]--
The MySQL query created and run is:
--[i]
Call:SELECT t0.id, t0.lastVerified, t0.name, t0.created, t0.description, t0.testsetdata, t0.forBug, t0.userName FROM testfire.testset t0 WHERE NOT EXISTS (SELECT DISTINCT t2.id FROM testfire.testrunnerqueue t2, trqueue_owns_testsets t1 WHERE (((t1.testset_id = t0.id) AND (t2.id = t1.testrunnerqueue_id)) AND (? = t2.id)))
[/i]--
Note the missing 'testfire.' from the 'trqueue_owns_testsets t1' table. If I add that little piece of info and run the query on my DB it works just fine.
I've done all sorts of fun things, like created an orm.xml file to set the default schema (no luck). Used 'schema' instead of 'catalog' on the @TABLE and @JOINCOLUMN annotations. No luck. I get the error:
--[i]
* Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
* Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'lgsrealm.trqueue_owns_testsets' doesn't existError Code: 1146
[/i]--
Followed by the above mentioned bad call.
The current (and original) state is that all entity relations are defined via Annotations. I removed the orm file, as I didn't have one before, but can add it back if there's a chance it will help :~)
The Queue side of the relation ship is:
--[i]
private List<TestsetEntity> testsets;
@ManyToMany
@JoinTable(catalog = "testfire", name = "trqueue_owns_testsets",
joinColumns = @JoinColumn( table = "testfire.trqueue_owns_testsets", name = "testrunnerqueue_id",referencedColumnName = "id", nullable = false),
inverseJoinColumns = @JoinColumn(table = "testfire.trqueue_owns_testsets", name = "testset_id",referencedColumnName = "id", nullable = false))
public List<TestsetEntity> getTestsets() {
return testsets;
}
public void setTestsets(List<TestsetEntity> testsets) {
this.testsets = testsets;
}
[/i]--
and the Testset side is:
--[i]
private List<TestRunnerQueueEntity> queues;
@ManyToMany(mappedBy = "testsets" )
public List<TestRunnerQueueEntity> getQueues() {
return queues;
}
public void setQueues(List<TestRunnerQueueEntity> queues) {
this.queues = queues;
}
[/i]--
Thoughts? Sections of the spec that cover this that I may have skimmed over to fast perhaps?
This is the only query I've run into that fails. It is also the most complex. This is not a DB heavy app, thankfully.
Thanks much,
Geoff[i][/i][i][/i]
[Message sent by forum member 'ggranum' (ggranum)]
http://forums.java.net/jive/thread.jspa?messageID=234449