[JBoss Seam] - Re: @Begin and @End
by baz
Hello Gavin.
anonymous wrote : It makes it unclear what "null" means ... does null mean "no id", or does it mean "no object for the id".
When getInstance is called and there is no Id in any context, session.get is not callable. So the if statement should ensure the pre condition for session.get.
My object which i want to manage is choosen by the user. When the user select the object i set the Id in the appropriate context.
In my app i do not know when a user has the selected the object. So it is possible that i reference this object when no id is set.
Concrete: On each of my pages i have to display the project number of the bazProject the user works on. But as long as the user has not choosen a project, the bazProjectID id will be null.
Ciao,
Carsten
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959772#3959772
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959772
19 years, 9 months
[EJB/JBoss] - EntityManager merge and the seam-registration example.
by hchafi
I have a question about merge and persist. I understand the basic difference between the two, but I am trying to undertand a bit more of the behavior of merge.
I modified the User.java class in the seam-registration example and added an Id field.
| @Id @GeneratedValue(strategy=GenerationType.AUTO)
| public Long getId() {
| return id;
| }
|
The problem I ran into is the "detached entity passed to persist" as I was trying to register multiple users. I guess persist expects the id field not to be set. At least that is what I gathered from other posts.
I switched to merge, and it works. I don't understand why it should work though. Since User is a session scoped entity bean, doesn't it mean it should remain alive during the whole session. in which case shouldn't the merge just update the same user instead of creating a new one. I inspected the database, and it does indeed create multiple users.
Can someone point to the hole in my understanding.
-hc
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959766#3959766
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959766
19 years, 9 months
[JBossCache] - Re: TreeCache data integrity across cluster
by manik.surtani@jboss.com
No, we don't have an explicit mechanism of obtaining a cluster-wide lock.
A local lock is obtained on method invocation and is maintained till your transaction ends (commits or rolls back).
Locks on remote instances are obtained and released during the 2-phase commit. (The prepare call attempts to acquire locks and updates data; the commit phase releases locks)
If the prepare phase cannot acquire the remote locks it needs within the given time (specified by the LockAcquisitionTimeout attribute) you see TimeoutExceptions.
You could also see TimeoutExceptions when trying to acquire the local lock if you have a lot of concurrent threads accessing the data.
You may want to try OPTIMISTIC locking, which greatly improves concurrency - at the cost of the occasional transaction failure due to validation clashes when updating concurrently accessed data.
Cheers,
Manik
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959765#3959765
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959765
19 years, 9 months