gdamour 2005/08/19 23:49:07
Added: modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping
AbstractEntityBean.java CMRMappingFacadeBean.java
CMRMappingFacadeHome.java
CMRMappingFacadeRemote.java CompoundPK.java
ManyOwningSideBean.java ManyOwningSideLocal.java
ManyOwningSideLocalHome.java
OneInverseSideBean.java OneInverseSideLocal.java
OneInverseSideLocalHome.java OneOwningSideBean.java
OneOwningSideLocal.java OneOwningSideLocalHome.java
Log:
o GERONIMO-675 CMR / CMP Fields should not be read-only
Some additional enhancement to support the scenario where a primary key column
is also a foreign key column.
This basically implements the rules that Jeremy was recommending to apply
in such a case:
when the primary key is set in the ejbCreate<Method> the associated CMR field,
i.e. the CMR mapped to the foreign key column, is marked as under
construction.
From this point, the CMR must be set before the commit of the current
transaction. If not set, then the transaction is marked as rolled back.
Also, if an attempt is made to reset the pk field by relating the entity to
the wrong entity, an IllegalStateException is thrown.
o Also sync the code with the refactoring of the Association and
AssociationEnd
classes: the Association.isOneToOne, isOneToMany, isManyToOne and
isManyToMany methods have been moved to AssociationEnd.
Revision Changes Path
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/AbstractEntityBean.java
Index: AbstractEntityBean.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: AbstractEntityBean.java,v 1.1 2005/08/20 03:49:06 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:06 $
*/
public abstract class AbstractEntityBean implements EntityBean {
private EntityContext ctx;
public void ejbLoad() {
}
public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
}
public void unsetEntityContext() {
this.ctx = null;
}
public void ejbStore() {
}
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/CMRMappingFacadeBean.java
Index: CMRMappingFacadeBean.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: CMRMappingFacadeBean.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.rmi.RemoteException;
import java.util.Collections;
import java.util.Set;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionContext;
import javax.ejb.TransactionRolledbackLocalException;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
import org.openejb.test.TestFailureException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public class CMRMappingFacadeBean implements javax.ejb.SessionBean {
private InitialContext jndiContext;
private SessionContext ctx;
private CompoundPK compoundPK_20_10;
private CompoundPK compoundPK_20_20;
public void testOneToOneSetCMROnOwningSide() throws TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
OneOwningSideLocal owningLocal =
createOneOwningSide(compoundPK_20_10);
owningLocal.setOneInverseSide(inverseLocal);
userTransaction.commit();
validateOneToOneRelationship(userTransaction);
removeOneToOne(userTransaction);
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToOneSetCMROnOwningSideResetPK() throws
TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
OneOwningSideLocal owningLocal =
createOneOwningSide(compoundPK_20_20);
owningLocal.setOneInverseSide(inverseLocal);
Assert.fail();
} catch (TransactionRolledbackLocalException e) {
if (false == e.getCause() instanceof IllegalStateException) {
throw new TestFailureException(new
AssertionFailedError("Received Exception " + e.getClass() + " : " +
e.getMessage()));
}
try {
userTransaction.rollback();
} catch (Exception e1) {
throw new TestFailureException(new
AssertionFailedError("Should not happen"));
}
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToOneSetCMROnInverseSide() throws TestFailureException
{
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
OneOwningSideLocal owningLocal =
createOneOwningSide(compoundPK_20_10);
inverseLocal.setOneOwningSide(owningLocal);
userTransaction.commit();
validateOneToOneRelationship(userTransaction);
removeOneToOne(userTransaction);
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToOneSetCMROnInverseSideResetPK() throws
TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
OneOwningSideLocal owningLocal =
createOneOwningSide(compoundPK_20_20);
inverseLocal.setOneOwningSide(owningLocal);
Assert.fail();
} catch (TransactionRolledbackLocalException e) {
if (false == e.getCause() instanceof IllegalStateException) {
throw new TestFailureException(new
AssertionFailedError("Received Exception " + e.getClass() + " : " +
e.getMessage()));
}
try {
userTransaction.rollback();
} catch (Exception e1) {
throw new TestFailureException(new
AssertionFailedError("Should not happen"));
}
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToOneDoNotSetCMR() throws TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
createOneOwningSide(compoundPK_20_10);
userTransaction.commit();
Assert.fail();
} catch (IllegalStateException e) {
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToManySetCMROnOwningSide() throws TestFailureException
{
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
ManyOwningSideLocal owningLocal =
createManyOwningSide(compoundPK_20_10);
owningLocal.setOneInverseSide(inverseLocal);
userTransaction.commit();
validateOneToManyRelationship(userTransaction);
removeOneToMany(userTransaction);
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToManySetCMROnOwningSideResetPK() throws
TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
ManyOwningSideLocal owningLocal =
createManyOwningSide(compoundPK_20_20);
owningLocal.setOneInverseSide(inverseLocal);
Assert.fail();
} catch (TransactionRolledbackLocalException e) {
if (false == e.getCause() instanceof IllegalStateException) {
throw new TestFailureException(new
AssertionFailedError("Received Exception " + e.getClass() + " : " +
e.getMessage()));
}
try {
userTransaction.rollback();
} catch (Exception e1) {
throw new TestFailureException(new
AssertionFailedError("Should not happen"));
}
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToManySetCMROnInverseSide() throws
TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
ManyOwningSideLocal owningLocal =
createManyOwningSide(compoundPK_20_10);
inverseLocal.setManyOwningSide(Collections.singleton(owningLocal));
userTransaction.commit();
validateOneToManyRelationship(userTransaction);
removeOneToMany(userTransaction);
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToManySetCMROnInverseSideResetPK() throws
TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
OneInverseSideLocal inverseLocal =
createOneInverseSide(compoundPK_20_10.field1);
ManyOwningSideLocal owningLocal =
createManyOwningSide(compoundPK_20_20);
inverseLocal.setManyOwningSide(Collections.singleton(owningLocal));
Assert.fail();
} catch (TransactionRolledbackLocalException e) {
if (false == e.getCause() instanceof IllegalStateException) {
throw new TestFailureException(new
AssertionFailedError("Received Exception " + e.getClass() + " : " +
e.getMessage()));
}
try {
userTransaction.rollback();
} catch (Exception e1) {
throw new TestFailureException(new
AssertionFailedError("Should not happen"));
}
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void testOneToManyDoNotSetCMR() throws TestFailureException {
UserTransaction userTransaction = ctx.getUserTransaction();
try {
userTransaction.begin();
createManyOwningSide(compoundPK_20_10);
userTransaction.commit();
Assert.fail();
} catch (IllegalStateException e) {
} catch (Throwable e) {
throw new TestFailureException(new AssertionFailedError("Received
Exception " + e.getClass() + " : " + e.getMessage()));
}
}
public void ejbCreate() throws javax.ejb.CreateException{
try {
jndiContext = new InitialContext();
compoundPK_20_10 = new CompoundPK(new Integer(20), new
Integer(10));
compoundPK_20_20 = new CompoundPK(new Integer(20), new
Integer(20));
} catch (Exception e){
throw new CreateException("Can not get the initial context:
"+e.getMessage());
}
}
public void setSessionContext(SessionContext ctx) throws
EJBException,RemoteException {
this.ctx = ctx;
}
public void ejbRemove() throws EJBException,RemoteException {
}
public void ejbActivate() throws EJBException,RemoteException {
}
public void ejbPassivate() throws EJBException,RemoteException {
}
private OneInverseSideLocal createOneInverseSide(Integer id) throws
Exception {
OneInverseSideLocalHome home = (OneInverseSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/OneInverseSideLocalHome"),
OneInverseSideLocalHome.class);
return home.create(id);
}
private OneInverseSideLocal findOneInverseSide(Integer id) throws
Exception {
OneInverseSideLocalHome home = (OneInverseSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/OneInverseSideLocalHome"),
OneInverseSideLocalHome.class);
return home.findByPrimaryKey(id);
}
private void removeOneInverseSide(Integer id) throws Exception {
findOneInverseSide(id).remove();
}
private void validateOneToOneRelationship(UserTransaction
userTransaction) throws Exception {
OneInverseSideLocal inverseLocal =
findOneInverseSide(compoundPK_20_10.field1);
userTransaction.begin();
Assert.assertEquals(compoundPK_20_10,
inverseLocal.getOneOwningSide().getPrimaryKey());
userTransaction.commit();
}
private void removeOneToOne(UserTransaction userTransaction) throws
NotSupportedException, SystemException, Exception, HeuristicMixedException,
HeuristicRollbackException, RollbackException {
userTransaction.begin();
removeOneOwningSide(compoundPK_20_10);
removeOneInverseSide(compoundPK_20_10.field1);
userTransaction.commit();
}
private OneOwningSideLocal createOneOwningSide(CompoundPK compoundPK)
throws Exception {
OneOwningSideLocalHome home = (OneOwningSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/OneOwningSideLocalHome"),
OneOwningSideLocalHome.class);
return home.create(compoundPK.id, compoundPK.field1);
}
private OneOwningSideLocal findOneOwningSide(CompoundPK compoundPK)
throws Exception {
OneOwningSideLocalHome home = (OneOwningSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/OneOwningSideLocalHome"),
OneOwningSideLocalHome.class);
return home.findByPrimaryKey(compoundPK);
}
private void removeOneOwningSide(CompoundPK compoundPK) throws Exception {
findOneOwningSide(compoundPK).remove();
}
private ManyOwningSideLocal createManyOwningSide(CompoundPK compoundPK)
throws Exception {
ManyOwningSideLocalHome home = (ManyOwningSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/ManyOwningSideLocalHome"),
ManyOwningSideLocalHome.class);
return home.create(compoundPK.id, compoundPK.field1);
}
private ManyOwningSideLocal findManyOwningSide(CompoundPK compoundPK)
throws Exception {
ManyOwningSideLocalHome home = (ManyOwningSideLocalHome)
PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/ejb/ManyOwningSideLocalHome"),
ManyOwningSideLocalHome.class);
return home.findByPrimaryKey(compoundPK);
}
private void removeManyOwningSide(CompoundPK compoundPK) throws Exception
{
findManyOwningSide(compoundPK).remove();
}
private void validateOneToManyRelationship(UserTransaction
userTransaction) throws NotSupportedException, SystemException, Exception,
HeuristicMixedException, HeuristicRollbackException, RollbackException {
OneInverseSideLocal inverseLocal =
findOneInverseSide(compoundPK_20_10.field1);
userTransaction.begin();
Set set = inverseLocal.getManyOwningSide();
Assert.assertEquals(1, set.size());
ManyOwningSideLocal owningLocal = (ManyOwningSideLocal)
set.iterator().next();
Assert.assertEquals(compoundPK_20_10, owningLocal.getPrimaryKey());
userTransaction.commit();
}
private void removeOneToMany(UserTransaction userTransaction) throws
NotSupportedException, SystemException, Exception, HeuristicMixedException,
HeuristicRollbackException, RollbackException {
userTransaction.begin();
removeManyOwningSide(compoundPK_20_10);
removeOneInverseSide(compoundPK_20_10.field1);
userTransaction.commit();
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/CMRMappingFacadeHome.java
Index: CMRMappingFacadeHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: CMRMappingFacadeHome.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface CMRMappingFacadeHome extends javax.ejb.EJBHome {
public CMRMappingFacadeRemote create() throws CreateException,
RemoteException;
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/CMRMappingFacadeRemote.java
Index: CMRMappingFacadeRemote.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: CMRMappingFacadeRemote.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.rmi.RemoteException;
import org.openejb.test.TestFailureException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface CMRMappingFacadeRemote extends javax.ejb.EJBObject {
public void testOneToOneSetCMROnOwningSide() throws RemoteException,
TestFailureException;
public void testOneToOneSetCMROnOwningSideResetPK() throws
RemoteException, TestFailureException;
public void testOneToOneSetCMROnInverseSide() throws RemoteException,
TestFailureException;
public void testOneToOneSetCMROnInverseSideResetPK() throws
RemoteException, TestFailureException;
public void testOneToOneDoNotSetCMR() throws RemoteException,
TestFailureException;
public void testOneToManySetCMROnOwningSide() throws RemoteException,
TestFailureException;
public void testOneToManySetCMROnOwningSideResetPK() throws
RemoteException, TestFailureException;
public void testOneToManySetCMROnInverseSide() throws RemoteException,
TestFailureException;
public void testOneToManySetCMROnInverseSideResetPK() throws
RemoteException, TestFailureException;
public void testOneToManyDoNotSetCMR() throws RemoteException,
TestFailureException;
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/CompoundPK.java
Index: CompoundPK.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: CompoundPK.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.io.Serializable;
/**
*
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public class CompoundPK implements Serializable {
public Integer id;
public Integer field1;
public CompoundPK() {};
public CompoundPK(Integer id, Integer field1) {
this.id = id;
this.field1 = field1;
}
public boolean equals(Object other) {
if ( false == other instanceof CompoundPK ) {
return false;
}
CompoundPK otherPK = (CompoundPK) other;
return field1.equals(otherPK.field1) && id.equals(otherPK.id);
}
public int hashCode() {
return field1.hashCode() ^ id.hashCode();
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/ManyOwningSideBean.java
Index: ManyOwningSideBean.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: ManyOwningSideBean.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.CreateException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public abstract class ManyOwningSideBean extends AbstractEntityBean {
// CMP
public abstract Integer getId();
public abstract void setId(Integer primaryKey);
public abstract Integer getField1();
public abstract void setField1(Integer field1);
// CMR
public abstract OneInverseSideLocal getOneInverseSide();
public abstract void setOneInverseSide(OneInverseSideLocal
oneInverseSideLocal);
public Integer ejbCreate(Integer id, Integer field1) throws
CreateException {
setId(id);
setField1(field1);
return null;
}
public void ejbPostCreate(Integer id, Integer field1) {
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/ManyOwningSideLocal.java
Index: ManyOwningSideLocal.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: ManyOwningSideLocal.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.EJBLocalObject;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface ManyOwningSideLocal extends EJBLocalObject {
// CMR
public OneInverseSideLocal getOneInverseSide();
public void setOneInverseSide(OneInverseSideLocal oneInverseSideLocal);
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/ManyOwningSideLocalHome.java
Index: ManyOwningSideLocalHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: ManyOwningSideLocalHome.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface ManyOwningSideLocalHome extends EJBLocalHome {
public ManyOwningSideLocal create(Integer id, Integer field1) throws
CreateException;
public ManyOwningSideLocal findByPrimaryKey(CompoundPK pk) throws
FinderException;
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneInverseSideBean.java
Index: OneInverseSideBean.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneInverseSideBean.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.util.Set;
import javax.ejb.CreateException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public abstract class OneInverseSideBean extends AbstractEntityBean {
// CMP
public abstract Integer getId();
public abstract void setId(Integer primaryKey);
// CMR
public abstract OneOwningSideLocal getOneOwningSide();
public abstract void setOneOwningSide(OneOwningSideLocal
oneOwningSideLocal);
public abstract Set getManyOwningSide();
public abstract void setManyOwningSide(Set set);
public Integer ejbCreate(Integer id) throws CreateException {
setId(id);
return null;
}
public void ejbPostCreate(Integer id) {
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneInverseSideLocal.java
Index: OneInverseSideLocal.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneInverseSideLocal.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import java.util.Set;
import javax.ejb.EJBLocalObject;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface OneInverseSideLocal extends EJBLocalObject {
// CMR
public OneOwningSideLocal getOneOwningSide();
public void setOneOwningSide(OneOwningSideLocal oneOwningSideLocal);
public Set getManyOwningSide();
public void setManyOwningSide(Set set);
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneInverseSideLocalHome.java
Index: OneInverseSideLocalHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneInverseSideLocalHome.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface OneInverseSideLocalHome extends EJBLocalHome {
public OneInverseSideLocal create(Integer id) throws CreateException;
public OneInverseSideLocal findByPrimaryKey(Integer id) throws
FinderException;
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneOwningSideBean.java
Index: OneOwningSideBean.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneOwningSideBean.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.CreateException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public abstract class OneOwningSideBean extends AbstractEntityBean {
// CMP
public abstract Integer getId();
public abstract void setId(Integer primaryKey);
public abstract Integer getField1();
public abstract void setField1(Integer field1);
// CMR
public abstract OneInverseSideLocal getOneInverseSide();
public abstract void setOneInverseSide(OneInverseSideLocal
oneInverseSideLocal);
public Integer ejbCreate(Integer id, Integer field1) throws
CreateException {
setId(id);
setField1(field1);
return null;
}
public void ejbPostCreate(Integer id, Integer field1) {
}
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneOwningSideLocal.java
Index: OneOwningSideLocal.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneOwningSideLocal.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.EJBLocalObject;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface OneOwningSideLocal extends EJBLocalObject {
// CMR
public OneInverseSideLocal getOneInverseSide();
public void setOneInverseSide(OneInverseSideLocal oneInverseSideLocal);
}
1.1
openejb/modules/itests/src/java/org/openejb/test/entity/cmp2/cmrmapping/OneOwningSideLocalHome.java
Index: OneOwningSideLocalHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: OneOwningSideLocalHome.java,v 1.1 2005/08/20 03:49:07 gdamour Exp $
*/
package org.openejb.test.entity.cmp2.cmrmapping;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:07 $
*/
public interface OneOwningSideLocalHome extends EJBLocalHome {
public OneOwningSideLocal create(Integer id, Integer field1) throws
CreateException;
public OneOwningSideLocal findByPrimaryKey(CompoundPK pk) throws
FinderException;
}