Re: two different databases at same time?
It should be quite straight forward. To show it works, I have just tested with 2 model, each point to their own db. It works as expected :) The testing environment however is mysql, and wo5.2.4, with plain vanila without PW. Don't think it is matter for test. Just to add, the database url are defined in each model. Cheers Cheong Hee - Original Message - From: Joe Little jmlit...@gmail.com To: Cheong Hee (Gmail) chn...@gmail.com Cc: David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 1:07 PM Subject: Re: two different databases at same time? I just checked and my models do indeed have a complete URL, etc in their default connection dictionaries. On Thu, Aug 5, 2010 at 7:57 PM, Cheong Hee (Gmail) chn...@gmail.com wrote: Will there make any difference if these connection dictionaries is defined in respective model db url? - Original Message - From: Joe Little jmlit...@gmail.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee (Gmail) chn...@gmail.com; David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 2:17 AM Subject: Re: two different databases at same time? So, I'm starting to wonder if something broke/changed in Wonder. I've set up test projects that list two DBs in the Properties file for two models, but only one is ever added to the connection dictionary. Does there need to workable values for the default database in the eomodeld directory itself? This has worked for me before, with one framework model and one local project model. This time, i have two models in one framework. On Aug 4, 2010, at 7:26 PM, Joe Little jmlit...@gmail.com wrote: You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com
Re: two different databases at same time?
Could it be something else that is the culprit? If you think worth to cross examine, let me know so that I could repackage the test files into eclipse project and send over. - Original Message - From: Cheong Hee (Gmail) chn...@gmail.com To: Joe Little jmlit...@gmail.com Cc: David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 3:09 PM Subject: Re: two different databases at same time? It should be quite straight forward. To show it works, I have just tested with 2 model, each point to their own db. It works as expected :) The testing environment however is mysql, and wo5.2.4, with plain vanila without PW. Don't think it is matter for test. Just to add, the database url are defined in each model. Cheers Cheong Hee - Original Message - From: Joe Little jmlit...@gmail.com To: Cheong Hee (Gmail) chn...@gmail.com Cc: David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 1:07 PM Subject: Re: two different databases at same time? I just checked and my models do indeed have a complete URL, etc in their default connection dictionaries. On Thu, Aug 5, 2010 at 7:57 PM, Cheong Hee (Gmail) chn...@gmail.com wrote: Will there make any difference if these connection dictionaries is defined in respective model db url? - Original Message - From: Joe Little jmlit...@gmail.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee (Gmail) chn...@gmail.com; David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 2:17 AM Subject: Re: two different databases at same time? So, I'm starting to wonder if something broke/changed in Wonder. I've set up test projects that list two DBs in the Properties file for two models, but only one is ever added to the connection dictionary. Does there need to workable values for the default database in the eomodeld directory itself? This has worked for me before, with one framework model and one local project model. This time, i have two models in one framework. On Aug 4, 2010, at 7:26 PM, Joe Little jmlit...@gmail.com wrote: You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign
Re: two different databases at same time?
I'll probably just show the code off at WOWODC.. I honestly think it has something to do with some aspect of the frameworks used. The only true delta between the projects that work (older) and this new one, is that the old would have models/dbs into two separate frameworks, and in those cases, only one had ERAttachment. This time around, I have ERAttachment for both relative to both DBs. There is some automagic with regards to ERAttachment tables and perhaps referencing two separate DBs for two separate models w/ ERAttachment is the real no-no. On Fri, Aug 6, 2010 at 2:53 AM, Cheong Hee (Gmail) chn...@gmail.com wrote: Could it be something else that is the culprit? If you think worth to cross examine, let me know so that I could repackage the test files into eclipse project and send over. - Original Message - From: Cheong Hee (Gmail) chn...@gmail.com To: Joe Little jmlit...@gmail.com Cc: David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 3:09 PM Subject: Re: two different databases at same time? It should be quite straight forward. To show it works, I have just tested with 2 model, each point to their own db. It works as expected :) The testing environment however is mysql, and wo5.2.4, with plain vanila without PW. Don't think it is matter for test. Just to add, the database url are defined in each model. Cheers Cheong Hee - Original Message - From: Joe Little jmlit...@gmail.com To: Cheong Hee (Gmail) chn...@gmail.com Cc: David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 1:07 PM Subject: Re: two different databases at same time? I just checked and my models do indeed have a complete URL, etc in their default connection dictionaries. On Thu, Aug 5, 2010 at 7:57 PM, Cheong Hee (Gmail) chn...@gmail.com wrote: Will there make any difference if these connection dictionaries is defined in respective model db url? - Original Message - From: Joe Little jmlit...@gmail.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee (Gmail) chn...@gmail.com; David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 2:17 AM Subject: Re: two different databases at same time? So, I'm starting to wonder if something broke/changed in Wonder. I've set up test projects that list two DBs in the Properties file for two models, but only one is ever added to the connection dictionary. Does there need to workable values for the default database in the eomodeld directory itself? This has worked for me before, with one framework model and one local project model. This time, i have two models in one framework. On Aug 4, 2010, at 7:26 PM, Joe Little jmlit...@gmail.com wrote: You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student
Re: two different databases at same time?
So, I'm starting to wonder if something broke/changed in Wonder. I've set up test projects that list two DBs in the Properties file for two models, but only one is ever added to the connection dictionary. Does there need to workable values for the default database in the eomodeld directory itself? This has worked for me before, with one framework model and one local project model. This time, i have two models in one framework. On Aug 4, 2010, at 7:26 PM, Joe Little jmlit...@gmail.com wrote: You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April
Re: two different databases at same time?
Will there make any difference if these connection dictionaries is defined in respective model db url? - Original Message - From: Joe Little jmlit...@gmail.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee (Gmail) chn...@gmail.com; David LeBer dleber_wo...@codeferous.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Friday, August 06, 2010 2:17 AM Subject: Re: two different databases at same time? So, I'm starting to wonder if something broke/changed in Wonder. I've set up test projects that list two DBs in the Properties file for two models, but only one is ever added to the connection dictionary. Does there need to workable values for the default database in the eomodeld directory itself? This has worked for me before, with one framework model and one local project model. This time, i have two models in one framework. On Aug 4, 2010, at 7:26 PM, Joe Little jmlit...@gmail.com wrote: You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database
Re: two different databases at same time?
Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/jmlittle%40gmail.com This email sent to jmlit...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/jmlittle%40gmail.com This email sent to jmlit...@gmail.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile:http://www.linkedin.com/in/davidleber twitter:http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com
Re: two different databases at same time?
On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/jmlittle%40gmail.com This email sent to jmlit...@gmail.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects
Re: two different databases at same time?
On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/jmlittle%40gmail.com
Re: two different databases at same time?
On 2010-08-04, at 2:36 PM, David LeBer wrote: On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Sigh, sorry more confusing. Create a vanilla COLUMN in the db... Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev
Re: two different databases at same time?
When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update
Re: two different databases at same time?
You gave me a good clue. I may be using the same damn ec On Aug 4, 2010, at 7:17 PM, Cheong Hee \(Gmail\) chn...@gmail.com wrote: When the question posted, I intended to find out if the different db works in the same ec. I have not thought more on the storing and fetching. I am not sure if this is right but merely bring it out for better understanding. Please point out whichever does not seem right: Said the Student table is in databaase A. The AdmitApplicant table is stored in database B. A row admitApplicantID is created in Student table and a relationship should be defined, said admitApplicant. The modelling cross different database should be fine. If I understand what David mentioned, the EOF fetch through relationship admitApplicant will fail. Therefore, I will assume that the fetch will have to be done by getting the admitApplicant key from Student, and then use the key to search the AdmitApplicant that is resided in database B. Good thing is both could be done in the same ec. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Joe Little jmlit...@gmail.com Cc: Cheong Hee chn...@gmail.com; WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, August 05, 2010 2:36 AM Subject: Re: two different databases at same time? On 2010-08-04, at 2:26 PM, Joe Little wrote: On Wed, Aug 4, 2010 at 11:20 AM, David LeBer dleber_wo...@codeferous.com wrote: On 2010-08-04, at 2:12 PM, Joe Little wrote: Digging up an old thread. This is the first time I'm creating a multi-database relation. When my migrations kick off to generate my newer database that has a single relation to the old, it fails in spectacular ways. Specifically, it has this error: Caused by: java.lang.RuntimeException: Failed to execute 'ALTER TABLE STUDENT ADD CONSTRAINT STUDENT_admitApplicantID_ID_FK FOREIGN KEY (admitApplicantID) REFERENCES ADMIT_APPLICANT (ID) DEFERRABLE INITIALLY DEFERRED'. PSQLException: ERROR: relation admit_applicant does not exist student has a relation to admit_applicant, where student is db2.student and admit_applicant is db1.admit_applicant This is keyed off this migration line: studentTable.addForeignKey(admitApplicantID, ADMIT_APPLICANT, ID); Don't do that. EOF is fine with cross database relationships but your DB probably isn't. So it won't like you trying to create a foreign key constraint to a different database, so don't. So, what is the alternative? Would a join table work -- I think that still has foreign key constraints. Or is it simply stating a differ type of join (not inner)? I haven't done this before so my lack of clue is telling. Sorry, I wasn't clear. Model the relationship in the EOModel, create a vanilla row in the db that will act as a foreign key for the relationship, but don't tell the db that it is a foreign key. Let EOF manage the relationship for you. Am I just missing some clue that others already have? On Thu, Apr 1, 2010 at 8:17 PM, Cheong Hee chn...@gmail.com wrote: Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names
Re: two different databases at same time?
On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile:http://www.linkedin.com/in/davidleber twitter:http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
On Apr 1, 2010, at 8:23 AM, David LeBer wrote: On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. I think you can fetch on them, you just can't qualify the fetch. It's an all-or-nothing thing. You can't have cross-model inheritance structures either, I don't believe. Dave Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
On 2010-04-01, at 8:38 AM, David Avendasora wrote: On Apr 1, 2010, at 8:23 AM, David LeBer wrote: On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. I think you can fetch on them, you just can't qualify the fetch. It's an all-or-nothing thing. Erm, yeah, that's what I meant. You can't have cross-model inheritance structures either, I don't believe. Dave Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site:http://codeferous.com blog:http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile:http://www.linkedin.com/in/davidleber twitter:http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
Apparently I have complicated it by thinking of using multi ec to handle respective database connections. Thanks for clarification.. Cheers Cheong Hee - Original Message - From: David LeBer dleber_wo...@codeferous.com To: Cheong Hee chn...@gmail.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 8:23 PM Subject: Re: two different databases at same time? On 2010-04-01, at 12:07 AM, Cheong Hee wrote: Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? You don't need multiple ec's unless you want them. Other than that it's transparent. EOEditingContext ec = ERXEC.newEditingContext(); Person p = (Person)EOUtitlites.createAndInsertInstance(ec, Person.ENTITY_NAME); // Person entity persists in database A Horse h = (Horse)EOUtitlites.createAndInsertInstance(ec, Horse.ENTITY_NAME); // Horse entity persists in database B // make chagnes to h and p ec.saveChanges(); // p saved to database A, h saved to database B You can model cross database relationships as long as you don't try and create a fetch based on them. Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber twitter: http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
two different databases at same time?
Hello - Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Thanks James ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
On 2010-03-31, at 11:15 AM, James Cicenia wrote: Hello - Is it possible to use two different databases, I guess via two different models? Yes, yes. I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Thanks James ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile:http://www.linkedin.com/in/davidleber twitter:http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: two different databases at same time?
Is there any pointers or sample code how these could be done to initiate connection and save changes in respective ec? Cheers Cheong Hee - Original Message - From: Mark Ritchie mark.ritc...@mac.com To: James Cicenia ja...@jimijon.com Cc: WO Dev Group webobjects-dev@lists.apple.com Sent: Thursday, April 01, 2010 1:05 AM Subject: Re: two different databases at same time? On 31/Mar/2010, at 8:15 AM, James Cicenia wrote: Is it possible to use two different databases, I guess via two different models? I will need to connect to an Oracle big database on a remote server and was wondering if I could also use a mySQL or postgres database for user control on local server. Yes, yes! You can have multiple concurrent connections! One for each EOModel! Just make sure that the entity names are unique across all EOModels! Good luck! M. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chng34%40gmail.com This email sent to chn...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com