geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Insolia (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GERONIMO-6474) Reactivated/Reloaded Entity Bean not restoring UUID. UUID is correct upon construction and is correct in the RDB.
Date Wed, 26 Jun 2013 11:57:21 GMT

     [ https://issues.apache.org/jira/browse/GERONIMO-6474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Anthony Insolia updated GERONIMO-6474:
--------------------------------------

    Description: 
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.

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.

  was:
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.

    
> 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.
> 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.

--
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

Mime
View raw message