persistence@glassfish.java.net

RE: (TopLink Essentials) bogus _at_JoinTable default value

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 30 Oct 2007 16:18:01 -0400

Hello Klaus,
    TopLink Essentials has defaulted uni-directional OneToMany mappings in its regression tests (see http://fisheye5.cenqua.com/browse/~raw,r=1.3/glassfish/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/advanced/Department.java ). This model is currently deploying as expected generating a JoinTable with expected defaults and TopLink is using that JoinTable when writing and reading the relationship.
    Does your application use orm.xml at all?
    Guy and I verified the tests manually and even changed the location of the annotations to field level and re-ran the tests so it does not appear to be a TopLink issue.
    If this issue continues for you could you create a bug at https://glassfish.dev.java.net/servlets/ProjectIssues (you must be logged in) and supply a Persistence Unit jar that reproduces this issue within the bug? I can then deploy the reproduction and track this issue down.
--Gordon

-----Original Message-----
From: Klaus Unger [mailto:UngerKlaus_at_gmx.de]
Sent: Tuesday, October 30, 2007 1:00 PM
To: persistence_at_glassfish.dev.java.net
Subject: Re: (TopLink Essentials) bogus @JoinTable default value


Hi,

a uni-directional mapping is exactly what is intended. What tables it uses is
up to toplink as I let him create the ddls.

Let me please add that I already posted it in the oracle forums where it was
confirmed as bug and I was directed to report it to Glassfish.
http://forums.oracle.com/forums/thread.jspa?threadID=576956&tstart=15

I have to admit that I am seriously concerned about this - a default value of
an unidirectional one-to-many relationship does not seem like a complex rare
special error-prone case to me. I can not believe I am the first to stumble
upon this one, but I fear many might have given up and not taken the hard
time to find the real cause of this. This might also be related to the poor
error messages of toplink.

Don't get me wrong, I like toplink but I want to point things that should be
better.

- Klaus


> Klaus,
>
> Notice that a mappedBy for a OneToMany is required otherwise it will
> default to a uni-directional mapping that uses a JoinTable.
>
> See the following sections 9.1.24 and 2.1.8.5 from the spec for more
> information.
>
> Cheers,
> Guy