Hi Alex, Thanks! Works great! I thought other people could be interested on it as well!
Simone ----- Original Message ----- From: "Alex Loubyansky" <[EMAIL PROTECTED]> To: "Simone Milani" <[EMAIL PROTECTED]> Sent: Monday, March 31, 2003 8:24 PM Subject: Re: NOT NULL relations > Sorry, it doesn't look to be enough for me to tell what is wrong. > > What is the scenario? Is it cascade-delete? If it is then here is the > tric: > <container-configurations> > <container-configuration extends="Standard CMP 2.x EntityBean"> > <container-name>custom container</container-name> > <sync-on-commit-only>true</sync-on-commit-only> > </container-configuration> > </container-configurations> > > By the spec, in cascade-delete the one-side is removed first, thus, > destroying relationships. This means null values for foreign key > fields. And when entity is removed, container synchronizes persistent > state. Thus writting nulls to the db. > To prevent this, you should set sync-on-commit-only to true. Then, > synchronization will occur only at commit time when many-side will be > deleted too. > > But be careful with sync-on-commit-only == true as it is not spec > compliant behavior. Well... non-null foreign key are already spec > non-compliant thing, though. > > alex > > > Monday, March 31, 2003, 8:08:59 PM, you wrote: > > SM> Hi Alex, > > SM> Sorry to bother you once again, but this is sitting between me and the JBoss production.... > > SM> jbosscmp-jdbc.xml > > SM> <cmp-field> > SM> <field-name>mDSId</field-name> > SM> <column-name>MV_MDS_ID</column-name> > SM> <not-null/> > > SM> <jdbc-type>NUMERIC</jdbc-type> > SM> <sql-type>NUMERIC(8)</sql-type> > > SM> </cmp-field> > SM> .. > SM> ... > SM> ... > SM> <ejb-relation> > SM> <ejb-relation-name>mDSKeyVector-mDSVectors</ejb-relation-name> > > SM> <ejb-relationship-role> > SM> <ejb-relationship-role-name>mDSKeyVector-has-mDSVectors</ejb-relationship-ro le-name> > SM> <key-fields> > SM> <key-field> > SM> <field-name>mDSId</field-name> > SM> <column-name>MV_MDS_ID</column-name> > SM> </key-field> > SM> </key-fields> > > SM> </ejb-relationship-role> > SM> <ejb-relationship-role> > SM> <ejb-relationship-role-name>mDSVector-has-mDSKeyVector</ejb-relationship-rol e-name> > SM> <key-fields/> > > SM> </ejb-relationship-role> > SM> </ejb-relation> > > SM> Error: > > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=<no method> > SM> 2003-03-31 17:59:44,506 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.MDSVector] Executing SQL: UPDATE MDS_VECTOR_1 SET MV_MDS_ID=?, MV_DATE_SAVED=? WHERE MV_KEY=? AND > SM> MV_DATE_SAVED=? > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.MDSVector.mDSId] Set parameter: index=1, jdbcType=NUMERIC, value=NULL > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.MDSVector.dateSa ved] Set parameter: index=2, jdbcType=DATE, value=Mon Mar 31 17:59:44 BST 2003 > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.MDSVector.mVKey] Set parameter: index=3, jdbcType=NUMERIC, value=7 > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.MDSVector.dateSa ved] Set parameter: index=4, jdbcType=DATE, value=Mon Mar 31 00:00:00 BST 2003 > SM> 2003-03-31 17:59:44,506 TRACE [org.jboss.ejb.plugins.lock.JDBCOptimisticLock] updateLockedFieldValue> field=dateSaved; value Mon Mar 31 17:59:44 BST 2003 > SM> 2003-03-31 17:59:44,521 TRACE [org.jboss.ejb.plugins.EntityLockInterceptor] End invoke, key=2276622 > SM> 2003-03-31 17:59:44,521 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally > SM> 2003-03-31 17:59:44,521 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException, causedBy: > SM> com.sybase.jdbc2.jdbc.SybSQLException: The column MV_MDS_ID in table MDS_VECTOR_1 does not allow null values. > > > SM> Any idea? > > SM> Thanks!!!! > > SM> Simone > > ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user