Cool, I'll close the Jira and keep an eye on it.
Andrus
On Apr 25, 2008, at 5:01 PM, Michael Gentry wrote:
I just did a simple test using the enum PK in a relationship. I
inserted, queried, and deleted an object pointing to the reference
table. All worked fine except one cosmetic glitch:
SELECT t0.state_fk, t0.first_name, t0.last_name, t0.pk FROM test_peeps
t0, test_enums t1 WHERE t0.state_fk = t1.state AND (t1.state = ?)
[bind: 1->state:[EMAIL PROTECTED]
The bind should show the actual enum value. This is with M3, though.
With the current trunk:
SELECT t0.state_fk, t0.first_name, t0.last_name, t0.pk FROM test_peeps
t0, test_enums t1 WHERE t0.state_fk = t1.state AND (t1.state = ?)
[bind: 1->state:VA=7]
So, the state gets cleaned up in the current build, which is what I
was hoping since I had changed the enum logging code (the 7 is the
ordinal position and the value it would be if mapped to an integer in
the DB). Switching to the extended enumerations gives:
SELECT t0.state_fk, t0.first_name, t0.last_name, t0.pk FROM test_peeps
t0, test_enums t1 WHERE t0.state_fk = t1.state AND (t1.state = ?)
[bind: 1->state:VIRGINIA='VA']
So ... I'm thinking it is OK.
On Thu, Apr 24, 2008 at 10:19 AM, Andrus Adamchik
<[EMAIL PROTECTED]> wrote:
That's the thing - I opened that Jira as a note to self without doing
immediate deeper investigation. So now I don't recall the exact
details. :-)
As for relationships, ideally it should work ... of course ... But
since FK
is not an ObjAttribute, it may get translated incorrectly when a
related
to-one fault ObjectId is instantiated. That would be a bug of course.
Andrus
On Apr 24, 2008, at 5:14 PM, Michael Gentry wrote:
I didn't try doing a relationship using the enum in the join. Did
you? I can try that, too, but I believe all of the translation code
goes through the same routines, so it should work there, too.
Thanks,
/dev/mrg
On Thu, Apr 24, 2008 at 10:11 AM, Andrus Adamchik
<[EMAIL PROTECTED]> wrote:
Yeah, your example works in all combinations of M3/trunk and
Extended
enum
vs. Java enum... I guess there was some other thing in my project
(that
I
since remapped as String) that made it blow... I can think of two
things
-
relationships and inheritance. I am pretty sure inheritance wasn't
involved.
So it was probably an issue similar to this:
https://issues.apache.org/cayenne/browse/CAY-1034
I guess we can close CAY-1014 and see if we can improve
relationship
validation...
Andrus
On Apr 24, 2008, at 4:35 PM, Michael Gentry wrote:
Hmm, I used the ExtendedEnumerations which aren't in M3. When I
changed my State class to look like:
public enum State
{
AL, AK, AR, AZ, DC, MD, TN, VA;
}
It still worked with M3.
On Thu, Apr 24, 2008 at 9:22 AM, Michael Gentry <[EMAIL PROTECTED]
>
wrote:
Sorry, already sent the attachment. Nothing sensitive in it,
though
(custom test db/table).
Let me see if I have M3 lying around and I'll try it.
/dev/mrg
On Thu, Apr 24, 2008 at 9:19 AM, Andrus Adamchik
<[EMAIL PROTECTED]> wrote:
Sure, or you can attach it to CAY-1014 if you don't have any
sensitive
info
in it.
Wonder if my related fix had any effect on this? Could you try
it
with
M3
if possible?
Thanks,
Andrus
On Apr 24, 2008, at 4:16 PM, Michael Gentry wrote:
Andrus, I'm going to send you a test I just did via e-mail
since
the
list doesn't support attachments. Enums as PKs worked for me.
What
issue were you seeing?
Thanks,
/dev/mrg