I'm posting this question here and on the Glorp mailing list
(separately) to improve my chances of getting a reply.. (hopefully), so I hope you'll bear with me.. I've got a Seaside App that needs to read various things from various PostgreSQL tables using Glorp.. So, I've got all of my descriptors setup for my >10 tables I need access to.. So far my Glorp session only knows about my "users" table which it uses to perform login validations. That code works great and can validate all day long.. However, I now have some other code that needs to lookup a list of state abbreviations (e.g. CA,AZ,UT,NV,etc) and I'm a bit confused about how to go about getting that descriptor plugged into my Glorp session.. I'd rather NOT open another database connection if at all possible (I'd hate to have one db connection for each table I'm talking to -- way too much overhead) and am wondering if I need to redefine my Glorp session code to know about ALL of my tables instead of a single one? Or, can I hijack the "users" Glorp session and temporarily ask it to talk to another set of descriptors at my discretion? I've read through the tutorials I've found but most were geared towards only talking to one table at a time or perhaps one table with a foreign key to another, but I didn't see any examples on IF you had two or more separate (unrelated for the most part) tables and how to setup Glorp to talk to those disparate tables at different times within the same database session. I've also review the Glorp unit tests and didn't see anything similar to what I'm asking about above, but did find a few things that looked close to what I want to do.. Any insight or pointers you can provide would be greatly appreciated! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I'm not sure what you mean by session knowing the tables. You can use the
session to query your domain objects via, self session readManyOf: User self session readManyOf: User where: [:usr | user username = supplied] etc But I suspect I may be missing something, so if you could clarify your question, that would help, Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Rick Flower Sent: Friday, June 30, 2006 9:20 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: [Seaside] Slightly OT -- Glorp session question.. I'm posting this question here and on the Glorp mailing list (separately) to improve my chances of getting a reply.. (hopefully), so I hope you'll bear with me.. I've got a Seaside App that needs to read various things from various PostgreSQL tables using Glorp.. So, I've got all of my descriptors setup for my >10 tables I need access to.. So far my Glorp session only knows about my "users" table which it uses to perform login validations. That code works great and can validate all day long.. However, I now have some other code that needs to lookup a list of state abbreviations (e.g. CA,AZ,UT,NV,etc) and I'm a bit confused about how to go about getting that descriptor plugged into my Glorp session.. I'd rather NOT open another database connection if at all possible (I'd hate to have one db connection for each table I'm talking to -- way too much overhead) and am wondering if I need to redefine my Glorp session code to know about ALL of my tables instead of a single one? Or, can I hijack the "users" Glorp session and temporarily ask it to talk to another set of descriptors at my discretion? I've read through the tutorials I've found but most were geared towards only talking to one table at a time or perhaps one table with a foreign key to another, but I didn't see any examples on IF you had two or more separate (unrelated for the most part) tables and how to setup Glorp to talk to those disparate tables at different times within the same database session. I've also review the Glorp unit tests and didn't see anything similar to what I'm asking about above, but did find a few things that looked close to what I want to do.. Any insight or pointers you can provide would be greatly appreciated! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Boris Popov wrote:
> I'm not sure what you mean by session knowing the tables. You can use the > session to query your domain objects via, > > self session readManyOf: User > > self session readManyOf: User where: [:usr | user username = supplied] > > etc > > But I suspect I may be missing something, so if you could clarify your > question, that would help, > Below is how my db connection is setup : [ login code is skipped for this ] db := Glorp.GlorpSession new. db system: (MSADBUserDescriptor forPlatform: login database). db accessor: accessor Once I do that I can issue the following and get an array of users: users := db readManyOf: MSADBUser. However, if I want to read one of the other tables using something like the following: states := db readManyOf: MSADBLocationLookup. I get an exception "Message not understood: #classesRequiringIndependentQueries" So, I'm guessing I need to use some other Glorp mechanism or change my "db system: ..." line from above to add more descriptors for other tables I might be reading during the same Seaside session or same Glorp session.. Am I barking up the right tree here? TIA! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Typically instead of a single descriptor you create descriptor systems that
describe your whole domain by subclassing DescriptorSystem and then creating your session via, system := MyDescriptorSystem forPlatform: login database. session := GlorpSession new. session accessor: (DatabaseAccessor forLogin: login). session system: system. There should be plenty of examples in GlorpTest for this. Hope this helps, -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Rick Flower Sent: Friday, June 30, 2006 9:44 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] Slightly OT -- Glorp session question.. Boris Popov wrote: > I'm not sure what you mean by session knowing the tables. You can use the > session to query your domain objects via, > > self session readManyOf: User > > self session readManyOf: User where: [:usr | user username = supplied] > > etc > > But I suspect I may be missing something, so if you could clarify your > question, that would help, > Below is how my db connection is setup : [ login code is skipped for this ] db := Glorp.GlorpSession new. db system: (MSADBUserDescriptor forPlatform: login database). db accessor: accessor Once I do that I can issue the following and get an array of users: users := db readManyOf: MSADBUser. However, if I want to read one of the other tables using something like the following: states := db readManyOf: MSADBLocationLookup. I get an exception "Message not understood: #classesRequiringIndependentQueries" So, I'm guessing I need to use some other Glorp mechanism or change my "db system: ..." line from above to add more descriptors for other tables I might be reading during the same Seaside session or same Glorp session.. Am I barking up the right tree here? TIA! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Boris Popov wrote:
> Typically instead of a single descriptor you create descriptor systems that > describe your whole domain by subclassing DescriptorSystem and then creating > your session via, > > system := MyDescriptorSystem forPlatform: login database. > session := GlorpSession new. > session accessor: (DatabaseAccessor forLogin: login). > session system: system. > > There should be plenty of examples in GlorpTest for this. > > Hope this helps, > but wasn't following why they were there or what they were doing (I didn't look too closely at them).. Do you know if this is mentioned in any of the Glorp tutorials or is it overlooked for the most part? Thanks! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
See page 24 of http://glorp.org/downloads/GlorpUserGuide.pdf
Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Rick Flower Sent: Friday, June 30, 2006 9:53 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] Slightly OT -- Glorp session question.. Boris Popov wrote: > Typically instead of a single descriptor you create descriptor systems that > describe your whole domain by subclassing DescriptorSystem and then creating > your session via, > > system := MyDescriptorSystem forPlatform: login database. > session := GlorpSession new. > session accessor: (DatabaseAccessor forLogin: login). > session system: system. > > There should be plenty of examples in GlorpTest for this. > > Hope this helps, > were there or what they were doing (I didn't look too closely at them).. Do you know if this is mentioned in any of the Glorp tutorials or is it overlooked for the most part? Thanks! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Boris Popov wrote:
> See page 24 of http://glorp.org/downloads/GlorpUserGuide.pdf > Cool.. That was one of the docs I didn't bother reading based on the description on the Glorp site which led be to believe it was a more basic sort of users guide and didn't dig too deeply into the functionality/uses of Glorp.. Thanks for pointing that out and helping me get beyond my current stumbling block.. You've saved my day! :-) _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |