Re: Bug in QueryReferenceBroker?

2004-05-13 Thread Armin Waibel
Hi Andrew,

I checked in a fix (similar to your patch + minor modifications in 
method) and a new test in AnonymousFieldsTest. The test fails with NPE 
when using QueryReferenceBroker version 1.15 and pass with latest version.
Hope this will solve your problem too.
Thank you very much!

regards,
java-dumbhead Armin
Armin Waibel wrote:
Hi Andrew,

seems you patch will do the job.
I will check this ASAP.
Thanks!
regards,
Armin
Clute, Andrew wrote:

I created what I think is an appropriate patch -- it fixed my issue.
Here it is.
Index: QueryReferenceBroker.java
===
RCS file:
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenc
eBroker.java,v
retrieving revision 1.15
diff -u -r1.15 QueryReferenceBroker.java
--- QueryReferenceBroker.java6 May 2004 19:45:57 -1.15
+++ QueryReferenceBroker.java12 May 2004 21:47:44 -
@@ -425,6 +425,7 @@
 {
 return new Identity(referencedObject, pb);
 }
+return null;
 }
 else
 {
 

-Original Message-
From: Clute, Andrew [mailto:[EMAIL PROTECTED] Sent: 
Wednesday, May 12, 2004 5:37 PM
To: OJB Users List; OJB Developers List
Subject: Bug in QueryReferenceBroker?

I recently updated to HEAD and am finding a weird issue now.

I have an object Session, that has a reference to an Object called
Person. Now Person is a proxy object. I am using an Anonymous FK to
reference Person from Session.
When I try to restore Session when it has no Person hanging on it, it
restores the Session object with a Person Proxy object hanging off of it
(it shouldn't!), and the Proxy's PK being a collection of null.
I think I might have narrowed down why it is happening:

Method getReferencedObjectIdentity(), here is a code snipet:

 if (hasNullifiedFKValue)
 {
  if(isAnonymousKeyReference(cld, rds))
   {
Object referencedObject = rds.getPersistentField().get(obj);
 if(referencedObject != null)
  {
return new Identity(referencedObject, pb);
 }
 }
  else
  {
  return null;
  }
  }
 // ensure that top-level extents are used for Identities
 return new Identity(rds.getItemClass(),
pb.getTopLevelClass(rds.getItemClass()), fkValues);
In my case, I have a nullifiedFKValue, so it goes into the first If
block, and then it sees that it is an AnonymousKeyReference, but then my
referencesObject us null (like it should be). But instead of returning
null, it jums out to the bottom where it returns a new Identity!! Why is
it doing that? I can see where Armin has made some changes to handle
better AnonymousFK's, is this a side-effect of that?
-ANdrew

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Bug in QueryReferenceBroker?

2004-05-13 Thread Clute, Andrew
Thanks for the quick response! I thought I was going crazy when I saw
that method and couldn't figure out why it was doing that. I assumed I
was just missing something in the bigger picture.

Glad we could find that before the next RC.

-Andrew

 

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 13, 2004 6:24 AM
To: OJB Users List
Subject: Re: Bug in QueryReferenceBroker?

Hi Andrew,

I checked in a fix (similar to your patch + minor modifications in
method) and a new test in AnonymousFieldsTest. The test fails with NPE
when using QueryReferenceBroker version 1.15 and pass with latest
version.
Hope this will solve your problem too.
Thank you very much!

regards,
java-dumbhead Armin

Armin Waibel wrote:
 Hi Andrew,
 
 seems you patch will do the job.
 I will check this ASAP.
 Thanks!
 
 regards,
 Armin
 
 Clute, Andrew wrote:
 
 I created what I think is an appropriate patch -- it fixed my issue.
 Here it is.

 Index: QueryReferenceBroker.java
 ===
 RCS file:
 /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryRefer
 enc
 eBroker.java,v
 retrieving revision 1.15
 diff -u -r1.15 QueryReferenceBroker.java
 --- QueryReferenceBroker.java6 May 2004 19:45:57 -1.15
 +++ QueryReferenceBroker.java12 May 2004 21:47:44 -
 @@ -425,6 +425,7 @@
  {
  return new Identity(referencedObject, pb);
  }
 +return null;
  }
  else
  {

  

 -Original Message-
 From: Clute, Andrew [mailto:[EMAIL PROTECTED] Sent: 
 Wednesday, May 12, 2004 5:37 PM
 To: OJB Users List; OJB Developers List
 Subject: Bug in QueryReferenceBroker?

 I recently updated to HEAD and am finding a weird issue now.

 I have an object Session, that has a reference to an Object called 
 Person. Now Person is a proxy object. I am using an Anonymous FK to 
 reference Person from Session.

 When I try to restore Session when it has no Person hanging on it, it

 restores the Session object with a Person Proxy object hanging off of

 it (it shouldn't!), and the Proxy's PK being a collection of null.

 I think I might have narrowed down why it is happening:

 Method getReferencedObjectIdentity(), here is a code snipet:

  if (hasNullifiedFKValue)
  {
   if(isAnonymousKeyReference(cld, rds))
{
 Object referencedObject =
rds.getPersistentField().get(obj);
  if(referencedObject != null)
   {
 return new Identity(referencedObject, pb);
  }
  }
   else
   {
   return null;
   }
   }

  // ensure that top-level extents are used for Identities
  return new Identity(rds.getItemClass(), 
 pb.getTopLevelClass(rds.getItemClass()), fkValues);

 In my case, I have a nullifiedFKValue, so it goes into the first If 
 block, and then it sees that it is an AnonymousKeyReference, but then

 my referencesObject us null (like it should be). But instead of 
 returning null, it jums out to the bottom where it returns a new 
 Identity!! Why is it doing that? I can see where Armin has made some 
 changes to handle better AnonymousFK's, is this a side-effect of
that?

 -ANdrew


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Bug in QueryReferenceBroker?

2004-05-12 Thread Clute, Andrew
I created what I think is an appropriate patch -- it fixed my issue.
Here it is.

Index: QueryReferenceBroker.java
===
RCS file:
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenc
eBroker.java,v
retrieving revision 1.15
diff -u -r1.15 QueryReferenceBroker.java
--- QueryReferenceBroker.java   6 May 2004 19:45:57 -   1.15
+++ QueryReferenceBroker.java   12 May 2004 21:47:44 -
@@ -425,6 +425,7 @@
 {
 return new Identity(referencedObject, pb);
 }
+return null;
 }
 else
 {

 

-Original Message-
From: Clute, Andrew [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 5:37 PM
To: OJB Users List; OJB Developers List
Subject: Bug in QueryReferenceBroker?

I recently updated to HEAD and am finding a weird issue now.

I have an object Session, that has a reference to an Object called
Person. Now Person is a proxy object. I am using an Anonymous FK to
reference Person from Session.

When I try to restore Session when it has no Person hanging on it, it
restores the Session object with a Person Proxy object hanging off of it
(it shouldn't!), and the Proxy's PK being a collection of null.

I think I might have narrowed down why it is happening:

Method getReferencedObjectIdentity(), here is a code snipet:

 if (hasNullifiedFKValue)
 {
  if(isAnonymousKeyReference(cld, rds))
   {
Object referencedObject = rds.getPersistentField().get(obj);
 if(referencedObject != null)
  {
return new Identity(referencedObject, pb);
 }
 }
  else
  {
  return null;
  }
  }

 // ensure that top-level extents are used for Identities
 return new Identity(rds.getItemClass(),
pb.getTopLevelClass(rds.getItemClass()), fkValues);

In my case, I have a nullifiedFKValue, so it goes into the first If
block, and then it sees that it is an AnonymousKeyReference, but then my
referencesObject us null (like it should be). But instead of returning
null, it jums out to the bottom where it returns a new Identity!! Why is
it doing that? I can see where Armin has made some changes to handle
better AnonymousFK's, is this a side-effect of that?

-ANdrew


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Bug in QueryReferenceBroker?

2004-05-12 Thread Armin Waibel
Hi Andrew,

seems you patch will do the job.
I will check this ASAP.
Thanks!
regards,
Armin
Clute, Andrew wrote:

I created what I think is an appropriate patch -- it fixed my issue.
Here it is.
Index: QueryReferenceBroker.java
===
RCS file:
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenc
eBroker.java,v
retrieving revision 1.15
diff -u -r1.15 QueryReferenceBroker.java
--- QueryReferenceBroker.java   6 May 2004 19:45:57 -   1.15
+++ QueryReferenceBroker.java   12 May 2004 21:47:44 -
@@ -425,6 +425,7 @@
 {
 return new Identity(referencedObject, pb);
 }
+return null;
 }
 else
 {
 

-Original Message-
From: Clute, Andrew [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 5:37 PM
To: OJB Users List; OJB Developers List
Subject: Bug in QueryReferenceBroker?

I recently updated to HEAD and am finding a weird issue now.

I have an object Session, that has a reference to an Object called
Person. Now Person is a proxy object. I am using an Anonymous FK to
reference Person from Session.
When I try to restore Session when it has no Person hanging on it, it
restores the Session object with a Person Proxy object hanging off of it
(it shouldn't!), and the Proxy's PK being a collection of null.
I think I might have narrowed down why it is happening:

Method getReferencedObjectIdentity(), here is a code snipet:

 if (hasNullifiedFKValue)
 {
  if(isAnonymousKeyReference(cld, rds))
   {
Object referencedObject = rds.getPersistentField().get(obj);
 if(referencedObject != null)
  {
return new Identity(referencedObject, pb);
 }
 }
  else
  {
  return null;
  }
  }
 // ensure that top-level extents are used for Identities
 return new Identity(rds.getItemClass(),
pb.getTopLevelClass(rds.getItemClass()), fkValues);
In my case, I have a nullifiedFKValue, so it goes into the first If
block, and then it sees that it is an AnonymousKeyReference, but then my
referencesObject us null (like it should be). But instead of returning
null, it jums out to the bottom where it returns a new Identity!! Why is
it doing that? I can see where Armin has made some changes to handle
better AnonymousFK's, is this a side-effect of that?
-ANdrew

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]