[jboss-user] [EJB 3.0] - Re: SerializationException when attempting to activate a sta
grdzeli_kaci
do-not-reply at jboss.com
Thu Feb 22 03:44:31 EST 2007
hi redyz,
i did it,
the problem is that in statefull session bean i had define Query class object and this class is not a serializable.
you must define this class as transient or use it only method scope.....
my programm example
| @Stateful
| @Remote(CountFasade.class)
| public class CountFasadeBean implements CountFasade {
|
| @PersistenceContext(unitName = "srvProvOracle")
| private EntityManager oracleManager;
|
| Query _query = null;
|
| public void addCount() throws Exception {
| try {
| _query = oracleManager.createNativeQuery("some query");
| } catch (Exception e) {
| e.printStackTrace();
| throw e;
| }
| }
| }
|
|
must be like this :
| @Stateful
| @Remote(CountFasade.class)
| public class CountFasadeBean implements CountFasade {
|
| @PersistenceContext(unitName = "srvProvOracle")
| private EntityManager oracleManager;
|
| @Transient
| Query _query = null;
|
| public void addCount() throws Exception {
| try {
| _query = oracleManager.createNativeQuery("some query");
| } catch (Exception e) {
| e.printStackTrace();
| throw e;
| }
| }
| }
|
or like this :
| @Stateful
| @Remote(CountFasade.class)
| public class CountFasadeBean implements CountFasade {
|
| @PersistenceContext(unitName = "srvProvOracle")
| private EntityManager oracleManager;
|
| public void addCount() throws Exception {
| try {
| Query _query = oracleManager.createNativeQuery("some query");
| } catch (Exception e) {
| e.printStackTrace();
| throw e;
| }
| }
| }
|
|
good luck
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020445#4020445
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020445
More information about the jboss-user
mailing list