You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Anthony Insolia (JIRA)" <ji...@apache.org> on 2013/07/01 20:10:22 UTC

[jira] [Commented] (GERONIMO-6474) Reactivated/Reloaded Entity Bean not restoring UUID. UUID is correct upon construction and is correct in the RDB.

    [ https://issues.apache.org/jira/browse/GERONIMO-6474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13697030#comment-13697030 ] 

Anthony Insolia commented on GERONIMO-6474:
-------------------------------------------

This problemis easily reproducable with the change of one line of code:
If @SessionScoped is changed to @ViewScoped the problem occurs.
                
> Reactivated/Reloaded Entity Bean not restoring UUID. UUID is correct upon construction and is correct in the RDB.
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-6474
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6474
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: OpenEJB
>    Affects Versions: 3.0.0
>         Environment: Apache Geronimo 3.0
> Apache Myfaces
> Primefaces
> MySQL
>            Reporter: Anthony Insolia
>
> I have a User class with an @OneToOne relationship to a Desktop class
> User->Desktop
> @Entity 
> @Table(name="user_table")
> @Unique(members={"name"}) 
> @ManagedBean(name = "User")
> @RequestScoped
> public class User extends Element_ implements Serializable {
> @Id 
>  private long uuid = 0;
> @OneToOne(targetEntity=Folder.class,cascade=CascadeType.ALL)
> @MapsId
>  private Folder desktop = null;
>  ...
> I was trying to save the User and their desktop and JPA informed me that the UUID at the superclass level didn't match the UUID at the subclass level.
> Here is some println's from a method in User market @PostLoad to see what the desktop UUID's are: 
> User (snoop) is looking at the desktop with THIS <uuid> 0
> User (snoop) is looking at the desktop with SUPER <uuid> 429823953
> 'snoop' is the name of the @PostLoad method in my User class
> I tried to repair the UUID as a work around but it causes an exception:
> <openjpa-2.1.1-r422266:1148538 nonfatal user error> org.apache.openjpa.util.InvalidStateException: Attempt to change a primary key field of a
> n instance that already has a final object id.  Only new, unflushed instances whose id you have not retrieved can have their primary keys cha
> nged.
> I saw the same probelm in another area of my code where the UUID was correct and then zero'ed. This problem seems to be directly attributable to the fact that a view controller is defined as @ViewScoped. I don't see the problem when I change the controller to @SessionScoped.
> Not sure what is going on here but these UUID's are getting zero'ed by someone/something/somecode both before getting stored and after reactivation. I am fairly confident that this is not my code that is causing the problem b/c I've tried to explcitiy update the UUID's but Geronimo won't let me b/c they have been made final by Geronimo. 
> FYI I am using the TABLE_PER_CLASS model

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira