Hi,

when i try to call remove for a BMP Entity Bean using castor, i get
the following exception(s):

[Einsatz] ejbFindByPrimaryKey called
[Einsatz] ejbLoad called
[Einsatz] ejbRemove called
[Einsatz] org.exolab.castor.persist.ObjectNotPersistentExceptionImpl:
The object of type ionacs.data.einsatz.Einsatzdaten is not persistent --
it was not queried or created within this transaction
[Einsatz]       at
org.exolab.castor.persist.TransactionContext.delete(TransactionContext.java:696)
[Einsatz]       at
org.exolab.castor.jdo.engine.DatabaseImpl.remove(DatabaseImpl.java:301)
[Einsatz]       at
ionacs.server.einsatz.EinsatzBean.ejbRemove(EinsatzBean.java:90)
[Einsatz]       at java.lang.reflect.Method.invoke(Native Method)
[Einsatz]       at
org.jboss.ejb.plugins.BMPPersistenceManager.removeEntity(BMPPersistenceManager.java:363)
[Einsatz]       at
org.jboss.ejb.EntityContainer.remove(EntityContainer.java:330)
[Einsatz]       at java.lang.reflect.Method.invoke(Native Method)
[Einsatz]       at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:622)
[Einsatz]       at

org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:208)
[Einsatz]       at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:204)
[Einsatz]       at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
[Einsatz]       at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)
[Einsatz]       at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
[Einsatz]       at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:144)
[Einsatz]       at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
[Einsatz]       at
org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:322)
[Einsatz]       at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:163)
[Einsatz]       at java.lang.reflect.Method.invoke(Native Method)
[Einsatz]       at sun.rmi.server.UnicastServerRef.dispatch(Unknown
Source)
[Einsatz]       at sun.rmi.transport.Transport$1.run(Unknown Source)
[Einsatz]       at java.security.AccessController.doPrivileged(Native
Method)
[Einsatz]       at sun.rmi.transport.Transport.serviceCall(Unknown
Source)
[Einsatz]       at
sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
[Einsatz]       at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
[Einsatz]       at java.lang.Thread.run(Unknown Source)
[Einsatz] ejbStore called
[Einsatz] org.exolab.castor.jdo.TransactionNotInProgressException: No
transaction in progress for the current thread
[Einsatz]       at
org.exolab.castor.jdo.engine.DatabaseImpl.getTransaction(DatabaseImpl.java:390)
[Einsatz]       at
org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:275)
[Einsatz]       at
ionacs.server.einsatz.EinsatzBean.ejbStore(EinsatzBean.java:63)
[Einsatz]       at java.lang.reflect.Method.invoke(Native Method)
[Einsatz]       at
org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:305)
[Einsatz]       at

org.jboss.ejb.plugins.EntitySynchronizationInterceptor$InstanceSynchronization.beforeCompletion(EntitySynchronizationInterceptor.java:343)
[Einsatz]       at
org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1104)
[Einsatz]       at org.jboss.tm.TxCapsule.rollback(TxCapsule.java:362)
[Einsatz]       at
org.jboss.tm.TransactionImpl.rollback(TransactionImpl.java:89)
[Einsatz]       at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
[Einsatz]       at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
[Einsatz]       at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:144)
[Einsatz]       at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
[Einsatz]       at
org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:322)
[Einsatz]       at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:163)
[Einsatz]       at java.lang.reflect.Method.invoke(Native Method)
[Einsatz]       at sun.rmi.server.UnicastServerRef.dispatch(Unknown
Source)
[Einsatz]       at sun.rmi.transport.Transport$1.run(Unknown Source)
[Einsatz]       at java.security.AccessController.doPrivileged(Native
Method)
[Einsatz]       at sun.rmi.transport.Transport.serviceCall(Unknown
Source)
[Einsatz]       at
sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
[Einsatz]       at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
[Einsatz]       at java.lang.Thread.run(Unknown Source)

here are is a little bit of my sourcecode:

public class EinsatzBean implements EntityBean {
    
    public Einsatzdaten data;
    public Integer Einsatznummer;
    
    public void ejbLoad() {
        System.out.println("ejbLoad called");
        try {
            Einsatznummer = (Integer) ctx.getPrimaryKey();
            Database db = this.getDatabase();
            data = (Einsatzdaten) db.load(Einsatzdaten.class,
Einsatznummer);
            db.close();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
    }
    
    public void ejbStore() {
        System.out.println("ejbStore called");
        try {
            Database db = this.getDatabase();
            db.update(data);
            db.close();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
    }
    
    public Integer ejbCreate() {
        System.out.println("ejbCreate called");
        try {
            Database db = this.getDatabase();
            data = new Einsatzdaten();
            db.create(data);
            db.close();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
        Einsatznummer = new Integer(data.Einsatznummer);
        return Einsatznummer;
    }
    
    public void ejbRemove() {
        System.out.println("ejbRemove called");
        try {
            Database db = this.getDatabase();
            db.remove(data);
            db.close();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
    }
    
    public Integer ejbFindByPrimaryKey(Integer Einsatznummer)
    throws javax.ejb.ObjectNotFoundException {
        System.out.println("ejbFindByPrimaryKey called");
        try {
            Database db = this.getDatabase();
            db.load(Einsatzdaten.class, Einsatznummer);
            db.close();
        } catch(org.exolab.castor.jdo.ObjectNotFoundException e) {
            throw new javax.ejb.ObjectNotFoundException();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
        return Einsatznummer;
    }
    
    private Database getDatabase() throws PersistenceException,
NamingException {
        InitialContext ic = new InitialContext();
        DataObjects jdo = (DataObjects)
ic.lookup("java:comp/env/jdo/castor");
        return jdo.getDatabase();
    }
    
}

Can anybody tell me, what i'm doing wrong?

Thank you,
Ralf



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to