OpenJPA does use the class name as a prefix for columns, for example if I
have a many to one relationship and I am using TablePerClass, then the
column name for the external reference is named like this:
ReferenceClass_key
For example in my "Asset" entity I have a reference to a "Contract" entity:
/** The contract. */
@ManyToOne(cascade={CascadeType.REFRESH})
private Contract contract;
This results in my Asset table having column named "contract_uniqueid"
because the field "uniqueid" is the primary key of my "Contract" entity.
Hope that makes sense.
Chris
-----Original Message-----
From: Tradingfours [mailto:[email protected]]
Sent: Friday, 26 February 2010 7:30 PM
To: [email protected]
Subject: Re: JPA adding class name to join column name
Thanks for taking the time to look at my example. I did try your suggestions
and they didn't resolve the issue. Since the example seems to have some
non-essential-to-the-problem definitions in it, I tried paring it down by
removing the interior class from the entity hierarchy and some other parts
of the entity, after which I CNR. So I started mapping the entities as per
my problem domain, and eventually I hit the issue again, this time on the
leaf entity, but again the entity is rather complex for a demo or test case.
Part of the problem is that I am constrained to make openjpa compatible with
an existing legacy table, rather than being able to make any change to the
table to conform to openjpa,
It would really be helpful for me in zeroing in on this, if I could know
understand the answer to the following 2 precise questions
1) Does openjpa EVER, under any circumstances,prefix "ENTITYCLASSNAME_" to a
column name, eg t1.MYCLASSNAME_MYFIELD? I have not seen anything in the doc
that talks about that.
If the answer is no, then knowing this is a bug, I'll make a proper test
case. If the answer is yes, then
2) WHY and under what circumstances, would openjpa be motivated to insert
entityclassname_ into a column name? Understaning that would probalby
pinpoint the part of my configuration that is causing it.
--
View this message in context:
http://n2.nabble.com/JPA-adding-class-name-to-join-column-name-tp4630454p463
7794.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.