IllegalStateException: PojoReference.incrementRefCount() , f
bahata Mar 18, 2008 1:37 AMHi
For the bug/enhancement-request submitted by me in Jira, it was said that
it is fixed in "Fixed in trunk and branches/2.1". Can I download the fixed version now? If yes , from where? Kindly let me know the link.
If the fixed version is not yet published , is there any way to get it immediately?
Thanks in advance
Bahata
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
If more than one field of one object (A) refers to another object (B) , java.lang.IllegalStateException: PojoReference.incrementRefCount() occurs while attaching object A in the cache
Created: Thursday 06:19 AM Updated: Thursday 05:54 PM
Component/s: Java Binding
Affects Version/s: None
Fix Version/s: 2.1.0.GA
Security Level: Public (Everyone can see)
Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment:
« Hide
Windows XP operating system. Hibernate is user as ORM to load objects from Microsoft SQL Server Database. We are not using the cache as hibernate's second level cache for our own reasons. The cache is used in fron of hibernate. First the object graph is getting loaded using hibernate's association. Then the objects are tried to get attached to cache.
Show »
Windows XP operating system. Hibernate is user as ORM to load objects from Microsoft SQL Server Database. We are not using the cache as hibernate's second level cache for our own reasons. The cache is used in fron of hibernate. First the object graph is getting loaded using hibernate's association. Then the objects are tried to get attached to cache.
Description « Hide
If more than one field of an object (A) refers to another object (B) , trying to attach object A to cache would cause a java.lang.IllegalStateException: PojoReference.incrementRefCount(): exception.
Say I have a Person class with two fields PrimaryAddress and SecondaryAddress. Now say I created a single address object A and assigned both the addresses to that
address A. Now if I try to attach the Person in my cache, it gives the exception:
" java.lang.IllegalStateException: PojoReference.incrementRefCount(): source fqn: /__JBossInternal__/pg/_ID_/aaa4z-hq7ub6-fdr124m4-1-fdr1256j-9 is already present."
I understand that, this is because the person object is trying to refer to the Address object twice, because of its two fields .So the PojoInstance.incrementRefCount() method is throwing the exception.
Now if I assign PrimaryAddress and SecondaryAddress fields of Person to diffrent Address objects, this exception disappears.
But in our product There are classes where two of its fields need to point to the same object. We are creating the object graph using hibernate association and are implementing pojo cache in front of hibernate(not as second level cache for certain reasons)
So can you kindly suggest a fix or any workaround for this problem?
Description
If more than one field of an object (A) refers to another object (B) , trying to attach object A to cache would cause a java.lang.IllegalStateException: PojoReference.incrementRefCount(): exception. Say I have a Person class with two fields PrimaryAddress and SecondaryAddress. Now say I created a single address object A and assigned both the addresses to that address A. Now if I try to attach the Person in my cache, it gives the exception: " java.lang.IllegalStateException: PojoReference.incrementRefCount(): source fqn: /__JBossInternal__/pg/_ID_/aaa4z-hq7ub6-fdr124m4-1-fdr1256j-9 is already present." I understand that, this is because the person object is trying to refer to the Address object twice, because of its two fields .So the PojoInstance.incrementRefCount() method is throwing the exception. Now if I assign PrimaryAddress and SecondaryAddress fields of Person to diffrent Address objects, this exception disappears. But in our product There are classes where two of its fields need to point to the same object. We are creating the object graph using hibernate association and are implementing pojo cache in front of hibernate(not as second level cache for certain reasons) So can you kindly suggest a fix or any workaround for this problem?
Show »
All Comments Work Log Change History Subversion Commits Sort Order: [Ascending order - Click to sort in descending order]
[ Permlink | « Hide ]
Jason T. Greene [13/Mar/08 09:30 AM]
Thanks for putting this out. The behavior you describe should be supported. I will fix this before GA. However, I should warn you that using the same object model with two different active mapping frameworks can lead to problems, since both expect to be in control of the object model. As an example, hibernate will sometimes return a proxy object, instead of the actual user object, and if this proxy is attached to the cache, POJO Cache will serialize it, since it's not tagged with @Replicable.
[ Show » ]
Jason T. Greene [13/Mar/08 09:30 AM] Thanks for putting this out. The behavior you describe should be supported. I will fix this before GA. However, I should warn you that using the same object model with two different active mapping frameworks can lead to problems, since both expect to be in control of the object model. As an example, hibernate will sometimes return a proxy object, instead of the actual user object, and if this proxy is attached to the cache, POJO Cache will serialize it, since it's not tagged with @Replicable.
[ Permlink | « Hide ]
Jason T. Greene [13/Mar/08 05:54 PM]
Fixed in trunk and branches/2.1