[transfer-dev] Re: manytoone on the table id column, not allowed?
http://docs.transfer-orm.com/wiki/Using_Composite_Keys.cfm http://docs.transfer-orm.com/wiki/Transfer_Configuration_File.cfm For examples: http://docs.transfer-orm.com/wiki/Example_Code.cfm#tPetmarket Mark On Mon, Feb 2, 2009 at 7:55 PM, henry henryho...@gmail.com wrote: My situation is this, I have a table named Job (jobId set to be an identity value). It records something else that's useful, but I have it simplified for this post. I also a table call JobVoid, that stores the datetime when the job is being voided (voidDateTime), by a Staff. So, a Job is void when it has an entry in the JobVoid table (an optional onetoone relationship). package name=Job object name=Job table=Job id name=jobId type=numeric generate=false / !-- jobID column -- manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone manytoone name=Void link to=Job.JobVoid column=jobId/ !-- jobID column used again -- /manytoone /object object name=JobVoid table=JobVoid id name=jobId type=numeric / property name=voidDateTime type=date column=voidDateTime nullable=false/ manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone /object /package o = transfer.new(Job.Job); o.setStaff(transfer.get(Staff.Staff, 1)); transfer.save(o); This will throw [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert explicit value for identity column in table 'Job' when IDENTITY_INSERT is set to OFF. SQLSTATE 23000 SQLINSERT INTO Job(staffId,jobId) VALUES ( (param 1) , (param 2)); select SCOPE_IDENTITY() as id However, if I comment out the manytoone relationship to JobVoid in Job, the save operation goes through flawlessly. So, is there a way to make this work in Transfer w/ changing the DB structure? If ID column is used in manytoone relationship is not supported, do you think Transfer should warn the user by throwing an exception upon validating the xml? Thanks, Henry -- E: mark.man...@gmail.com W: www.compoundtheory.com --~--~-~--~~~---~--~~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups transfer-dev group. To post to this group, send email to transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~--~~~~--~~--~--~---
[transfer-dev] Re: manytoone on the table id column, not allowed?
If you make it a OneToMany in JobVoid then you'd be able to interrogate it from Job using hasParentJobVoid(). Bob On Mon, Feb 2, 2009 at 4:48 AM, henry henryho...@gmail.com wrote: Thank you for your prompt response, but... This is not a case of composite Keys, 'cause VoidJob only has one ID to Job, staffID is not a key. I have read Transfer_Configuration_File.cfm, but it does not say anything about *identity ID column cannot be used in manytoone on the same table*. After looking at PetMarket, I guess I can move the manytoone relationship from Job to JobVoid, since technically it is onetoone. However, it'd be nice if it is in Job object because then I can see if it is void or not after read. Thanks, Henry On Feb 2, 1:12 am, Mark Mandel mark.man...@gmail.com wrote: http://docs.transfer-orm.com/wiki/Using_Composite_Keys.cfmhttp://docs.transfer-orm.com/wiki/Transfer_Configuration_File.cfm For examples:http://docs.transfer-orm.com/wiki/Example_Code.cfm#tPetmarket Mark On Mon, Feb 2, 2009 at 7:55 PM, henry henryho...@gmail.com wrote: My situation is this, I have a table named Job (jobId set to be an identity value). It records something else that's useful, but I have it simplified for this post. I also a table call JobVoid, that stores the datetime when the job is being voided (voidDateTime), by a Staff. So, a Job is void when it has an entry in the JobVoid table (an optional onetoone relationship). package name=Job object name=Job table=Job id name=jobId type=numeric generate=false / !-- jobID column -- manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone manytoone name=Void link to=Job.JobVoid column=jobId/ !-- jobID column used again -- /manytoone /object object name=JobVoid table=JobVoid id name=jobId type=numeric / property name=voidDateTime type=date column=voidDateTime nullable=false/ manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone /object /package o = transfer.new(Job.Job); o.setStaff(transfer.get(Staff.Staff, 1)); transfer.save(o); This will throw [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert explicit value for identity column in table 'Job' when IDENTITY_INSERT is set to OFF. SQLSTATE 23000 SQLINSERT INTO Job(staffId,jobId) VALUES ( (param 1) , (param 2)); select SCOPE_IDENTITY() as id However, if I comment out the manytoone relationship to JobVoid in Job, the save operation goes through flawlessly. So, is there a way to make this work in Transfer w/ changing the DB structure? If ID column is used in manytoone relationship is not supported, do you think Transfer should warn the user by throwing an exception upon validating the xml? Thanks, Henry -- E: mark.man...@gmail.com W:www.compoundtheory.com -- Bob Silverberg www.silverwareconsulting.com --~--~-~--~~~---~--~~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups transfer-dev group. To post to this group, send email to transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~--~~~~--~~--~--~---
[transfer-dev] Re: manytoone on the table id column, not allowed?
Thank you for your prompt response, but... This is not a case of composite Keys, 'cause VoidJob only has one ID to Job, staffID is not a key. I have read Transfer_Configuration_File.cfm, but it does not say anything about *identity ID column cannot be used in manytoone on the same table*. After looking at PetMarket, I guess I can move the manytoone relationship from Job to JobVoid, since technically it is onetoone. However, it'd be nice if it is in Job object because then I can see if it is void or not after read. Thanks, Henry On Feb 2, 1:12 am, Mark Mandel mark.man...@gmail.com wrote: http://docs.transfer-orm.com/wiki/Using_Composite_Keys.cfmhttp://docs.transfer-orm.com/wiki/Transfer_Configuration_File.cfm For examples:http://docs.transfer-orm.com/wiki/Example_Code.cfm#tPetmarket Mark On Mon, Feb 2, 2009 at 7:55 PM, henry henryho...@gmail.com wrote: My situation is this, I have a table named Job (jobId set to be an identity value). It records something else that's useful, but I have it simplified for this post. I also a table call JobVoid, that stores the datetime when the job is being voided (voidDateTime), by a Staff. So, a Job is void when it has an entry in the JobVoid table (an optional onetoone relationship). package name=Job object name=Job table=Job id name=jobId type=numeric generate=false / !-- jobID column -- manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone manytoone name=Void link to=Job.JobVoid column=jobId/ !-- jobID column used again -- /manytoone /object object name=JobVoid table=JobVoid id name=jobId type=numeric / property name=voidDateTime type=date column=voidDateTime nullable=false/ manytoone name=Staff link to=Staff.Staff column=staffId/ /manytoone /object /package o = transfer.new(Job.Job); o.setStaff(transfer.get(Staff.Staff, 1)); transfer.save(o); This will throw [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert explicit value for identity column in table 'Job' when IDENTITY_INSERT is set to OFF. SQLSTATE 23000 SQL INSERT INTO Job(staffId,jobId) VALUES ( (param 1) , (param 2)); select SCOPE_IDENTITY() as id However, if I comment out the manytoone relationship to JobVoid in Job, the save operation goes through flawlessly. So, is there a way to make this work in Transfer w/ changing the DB structure? If ID column is used in manytoone relationship is not supported, do you think Transfer should warn the user by throwing an exception upon validating the xml? Thanks, Henry -- E: mark.man...@gmail.com W:www.compoundtheory.com --~--~-~--~~~---~--~~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups transfer-dev group. To post to this group, send email to transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~--~~~~--~~--~--~---