[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-16 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972130#action_12972130
 ] 

Mark Struberg commented on OPENJPA-1900:


Hi Rick! I'm currently compiling, so gimme an hour ;)
I'm online in #openjpa on freenode.

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-fix.patch, OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-16 Thread Rick Curtis (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972128#action_12972128
 ] 

Rick Curtis commented on OPENJPA-1900:
--

Mark -

It looks like I should have read through all of your comments... I added 
@OneToOne to Annuity.getPreviousAnnuity() and things are looking better now.

Thanks,
Rick


> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-fix.patch, OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-15 Thread Rick Curtis (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12971881#action_12971881
 ] 

Rick Curtis commented on OPENJPA-1900:
--

Good work on this one. I just looked at your patches and you had to dig pretty 
deep to figure this out out. 

I have a few comments for you. I was able to recreate the CCE, but after 
applying the code fix I fail with a NPE coming from test code[1]. I'm not sure 
why that field is null but I'm guessing it has something to do with the 
DetachState setting. If I change fgs to loaded the NPE goes away Are you 
seeing the same benaviour?

Thanks,
Rick

[1]:407 ann.getPreviousAnnuity().setApprovedAt( new Date() ); -- 
getPreviousAnnuity() returns null

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-fix.patch, OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-02 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966269#action_12966269
 ] 

Mark Struberg commented on OPENJPA-1900:


The Externalizable field gets added if I use the openjpa.DetachStage 
fetch-groups(DetachStateField=true)

This is an issues in our test suite currently - it uses different 
persistence.xml for enhancing 
(${project.build.testOutputDirectory}/META-INF/nopriv_persistence.xml) and 
running the tests (org/apache/openjpa/persistence/proxy/persistence1.xml)

Thus my test currently succeeds but only because this isn't a real world 
scenario.

PS: took me a while to figure this, but at least I'm now pretty deep into 
OpenJPA internals :D

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-02 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966249#action_12966249
 ] 

Mark Struberg commented on OPENJPA-1900:


think I know the difference between the openjpa-persistence-jdbc and my 
projects config. I use the openjpa-maven-plugin for enhancing my project and I 
get the Externalizable interface generated into my enhanced classes. This 
doesn't happen with the Annuity entities.

But the problem above only happens if StateManagerImpl#writeDetached get's 
invoked on an entity which is linked to multiple other entites...

Question: why do I get the Externalizable interface in my entities?

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-02 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966085#action_12966085
 ] 

Mark Struberg commented on OPENJPA-1900:


actually it was my error, forgot to @OneToOne the field ... *slap*,  
*coffeerefill*

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-test-1.patch
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (OPENJPA-1900) ClassCastException when serializing an entity if DetachedStateField=true

2010-12-01 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965662#action_12965662
 ] 

Mark Struberg commented on OPENJPA-1900:


I was still not able to reproduce this in a unit test, but from debugging my 
real world app it seems to happen when lazy loaded entities get serialized.

> ClassCastException when serializing an entity if DetachedStateField=true
> 
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
>  Issue Type: Bug
>  Components: kernel
>Affects Versions: 2.0.1, 2.1.0
>Reporter: Mark Struberg
> Fix For: 2.1.0
>
>
> When using 
>  value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl 
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
>   at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
>   at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown 
> Source)
>   at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at 
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at 
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
>   at 
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
>   at 
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
>   at 
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.