[transfer-dev] Re: manytomany... not quite
Hi Matt! Actually, trying to save the object PersonOrg still throws a duplicate column name error :( I thought that it was fixed because I configured a copy of the original object PersonOrgPlain in transfer.xml with no relation to Person or Org, and was saving this kind of object. What works better is the view of the Person page with the list of related Orgs and Projects. I guess there's no way of saving objects that are the end of a o2m relation, because they will always have an extra foreignKeyId field... I'd like to have all the relationship Object's data management within the same configuration, but I can live with duplicating the objects that deal with m2m relations for now... I'd like to find a more elegant solution, from the data model's design and coding perspective though. Any suggestions apart from overwriting the generated methods in the PersonOrg objects? TIA, Pedro. --~--~-~--~~~---~--~~ 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: manytomany... not quite
Hi Matt! Thanks for the response... On Sep 3, 3:07 am, Matt Quackenbush quackfu...@gmail.com wrote: Can you post the relevant transfer.xml configs? I could be mistaken, but I think the issue is that you have an o2m on one side and an m2o on the other. AFAIK, that will not do the trick. Why not? what is the problem, and how can I solve it? Here is the relevant section of my transfer.xml: package name=dc object name=Person table=Persons id name=PersonId type=string generate=false column=PERSON_ID / property name=Name type=string nullable=false column=FIRST_NAME / ... onetomany name=PersonOrg lazy=true link to=dc.PersOrg column=PERSON_ID / collection type=array /collection /onetomany onetomany name=PersonProj lazy=true link to=dc.PersonProj column=PERSON_ID / collection type=array /collection /onetomany /object ... Org and Project definitions are similar to Person's. object name=PersonOrg table=PersonOrg id name=PersOrgId type=string generate=false column=PERS_ORG_ID / property name=Role type=string nullable=true column=ROLE / ... manytoone name=Person lazy=true link column=PERSON_ID to=dc.Person / /manytoone manytoone name=Org lazy=true link column=ORG_ID to=dc.Org / /manytoone /object /package --~--~-~--~~~---~--~~ 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: manytomany... not quite
Howdee :-) You're welcome. OK, so that is exactly what I thought you were doing. The reason that will not work is because the o2m generates methods on *both* objects in the relationship, and therefore generates the ID (PK/FK) in the SQL twice. Instead, create an m2o on *both* objects (instead of just the PersonOrg object). Then you can use a decorator to add in whatever functionality you need to get at the other object (e.g. to replace the methods that would be generated by an o2m but will not be generated by the m2o). So, something like this... object name=Person table=Persons id name=PersonId type=string generate=false column=PERSON_ID / property name=Name type=string nullable=false column=FIRST_NAME / ... manytoone name=PersonOrg lazy=true link to=dc.PersOrg column=PERSON_ID / /manytoone manytoone name=PersonProj lazy=true link to=dc.PersonProj column=PERSON_ID / /manytoone /object (The above was copied and pasted in a hurry, so it very well may have typos in it. Please double check it before ya use it. Heh.) HTH --~--~-~--~~~---~--~~ 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: manytomany... not quite
The only methods (for the relationship) that will be generated are the m2o ones. http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#ManyToOne_Element So, any of the other o2m methods that have to do with getting at the child(ren)/parent will not be generated. http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#OneToMany_Element For your list methods, you'd just add a decorator method (you can use the same name if you'd like... e.g. getPersonOrgArray()) and then either pass it off to your Service (recommended) for processing or do your TQL there in the decorator (arguably quicker, but dirtier, imo). HTH --~--~-~--~~~---~--~~ 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: manytomany... not quite
I already had all I needed... and a little more. I was actually making the mistake described on this page: http://docs.transfer-orm.com/wiki/Same_foreign_key_for_a_manytoone_and_a_onetomany.cfm So I removed the m2o relation from my relations' objects, the PersonOrg mentioned in previous messages. To show the org info when showing a Person object (org name, acronym, etc), with its list (getPersonOrgArray) of related PersonOrg records (Role), I used the getParentOrg method available at the many end of the o2m relation Org-PersonOrg... works like a charm, and I think it loads faster also! Thanks for pointing me in the right direction... I owe you one ;) Pedro. --~--~-~--~~~---~--~~ 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: manytomany... not quite
Schwet! I love it when a plan comes together. :-) --~--~-~--~~~---~--~~ 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: manytomany... not quite
Can you post the relevant transfer.xml configs? I could be mistaken, but I think the issue is that you have an o2m on one side and an m2o on the other. AFAIK, that will not do the trick. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---