Well, it seems to work fine for me.
Here's a diff (hopefully not too messed up by my email client):
diff -c -r1.14 StatefulSessionFilePersistenceManager.java
*** StatefulSessionFilePersistenceManager.java 2000/11/13 18:57:19 1.14
--- StatefulSessionFilePersistenceManager.java 2000/11/21 02:45:47
***************
*** 159,164 ****
--- 159,170 ----
public void createSession(Method m, Object[] args,
StatefulSessionEnterpriseContext ctx)
throws Exception
{
+ // Set id
+ ctx.setId(nextId());
+
+ // Create EJBObject
+
+ctx.setEJBObject(con.getContainerInvoker().getStatefulSessionEJBObject(ctx.getId()));
+
// Get methods
try
{
***************
*** 195,208 ****
}
}
- // Set id
- ctx.setId(nextId());
-
// Insert in cache
((StatefulSessionContainer)con).getInstanceCache().insert(ctx);
-
- // Create EJBObject
-
ctx.setEJBObject(con.getContainerInvoker().getStatefulSessionEJBObject(ctx.getId()));
}
public void activateSession(StatefulSessionEnterpriseContext ctx)
--- 201,208 ----
Toby Allsopp wrote:
>
> Hello.
>
> I'm having a problem with SessionContext.getEJBObject() in the
> ejbCreate() method of a stateful session bean. The problem is that the
> id of the bean is null. The reason is that
> StatefulSessionFilePersistenceManager assigns the id after calling
> ejbCreate. It seems that a trivial fix is to move the
> ctx.setId(nextId()) to before the createMethod.invoke(...).
>
> Or am I missing something and this would break everything horribly?
>
> Regards,
> Toby.
>
> P.S. jBoss-2.0_FINAL (current CVS is the same)
--
Toby Allsopp
Research
Peace Software International Ltd
Ph +64-9-3730400