As a sidenote, here's what I'm seeing. This is a long, long, long stack trace.
The highlights are:
1) SEVERE warning reported. This is correct; it is failing because of a foreign key constraint violation.
2) Castor then confusingly reports a ClassMolder problem. (There is no ClassMolder problem. Really, honestly. It's fine. Works so long as objects get added one-at-a-time; the underlying exception is making an arse out of it.)
3) Castor confusingly reports another ClassMolder problem. Ditto. Again, works fine so long as the objects are added one at a time, rather than update on a tree of objects to be created.
4) Castor reports the actual exception: java.sql.SQLException: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_auth_user_subscription_service_auth_user_subscription'. The conflict occurred in database 'wow1', table 'auth_user_subscription', column 'id'.
Which is happening because the auth_user_subscription_service table requires that a valid id be set during its creation, but that ID is not set.
Now, I modified setId() to automatically update those fields in the children, but it appears that either 1) castor is creating the objects in the wrong order, or 2) castor never calls setId() on a timely basis in order for those to get set correctly before it calls create() on the dependent object.
Jul 21, 2004 12:25:34 PM org.exolab.castor.jdo.engine.SQLEngine create
SEVERE: A fatal error occurred while creating/updating com.wow.framework.dao.UserSubscriptionService using SQL: I
NSERT INTO "auth_user_subscription_service" ("user_subscription_id","name","activation_date","termination_date")
VALUES (?,?,?,?)
org.exolab.castor.jdo.DataObjectAccessException: no method to set value for field: com.wow.framework.dao.UserSubs
cription in class: ClassMolder com.wow.framework.dao.User
at org.exolab.castor.persist.FieldMolder.setValue(FieldMolder.java:316)
at org.exolab.castor.persist.ClassMolder.revertObject(ClassMolder.java: 2559)
at org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:856)
at org.exolab.castor.persist.TransactionContext.rollback(TransactionContext .java:1725)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:498)
at com.wow.framework.dao.jdo.impl.AbstractJDOLoader.release(AbstractJDOLoad er.java:70)
at com.wow.framework.dao.jdo.impl.DAOFactory.updateUser(DAOFactory.java: 456)
[...]
org.exolab.castor.jdo.DataObjectAccessException: no method to set value for field: com.wow.framework.dao.Scrap in
class: ClassMolder com.wow.framework.dao.ScrapBook
at org.exolab.castor.persist.FieldMolder.setValue(FieldMolder.java:316)
at org.exolab.castor.persist.ClassMolder.revertObject(ClassMolder.java: 2559)
at org.exolab.castor.persist.LockEngine.revertObject(LockEngine.java:856)
at org.exolab.castor.persist.TransactionContext.rollback(TransactionContext .java:1725)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:498)
at com.wow.framework.dao.jdo.impl.AbstractJDOLoader.release(AbstractJDOLoad er.java:70)
at com.wow.framework.dao.jdo.impl.DAOFactory.updateUser(DAOFactory.java: 456)
[...]
java.sql.SQLException: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_auth_user_subscription_
service_auth_user_subscription'. The conflict occurred in database 'wow1', table 'auth_user_subscription', column
'id'.
at net.sourceforge.jtds.jdbc.SqlMessage.toSQLException(SqlMessage.java: 392)
at net.sourceforge.jtds.jdbc.SQLWarningChain.addOrReturn(SQLWarningChain.ja va:91)
at net.sourceforge.jtds.jdbc.Tds.goToNextResult(Tds.java:750)
at net.sourceforge.jtds.jdbc.TdsStatement.getMoreResults(TdsStatement.java: 710)
at net.sourceforge.jtds.jdbc.TdsStatement.executeCallImpl(TdsStatement.java :302)
at net.sourceforge.jtds.jdbc.TdsStatement.internalExecuteCall(TdsStatement. java:282)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.execute(PreparedStateme nt_base.java:136)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeUpdate(PreparedS tatement_base.java:290)
at org.enhydra.jdbc.core.CorePreparedStatement.executeUpdate(CorePreparedSt atement.java:99)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:630)
at org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:916)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:495)
at org.exolab.castor.persist.TransactionContext.prepare(TransactionContext. java:1499)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:495)
at com.wow.framework.dao.jdo.impl.AbstractJDOLoader.release(AbstractJDOLoad er.java:70)
at com.wow.framework.dao.jdo.impl.DAOFactory.updateUser(DAOFactory.java: 456)
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
