Re: Different Database Connection per session for the same model

2012-06-18 Thread Lon Varscsak
Here's how I implemented it (it's actually quite simple): In Session.java: public ERXObjectStoreCoordinator defaultObjectStoreCoordinator() { return defaultObjectStoreCoordinator; } public void setDefaultObjectStoreCoordinator(ERXObjectStoreCoordinator defaultObjectStoreCoordinator) { if

Re: Different Database Connection per session for the same model

2012-06-18 Thread Alexis Tual
I agree, cross model relationships with different database connections shouldn't be used in real applications : eof bugs aside, there's one major problem : it's not transactionnal. Larry setup is interesting though, looks like the new old wo 4.5.1 :), the optimistic locking will work for sure ! Al

Re: Different Database Connection per session for the same model

2012-06-18 Thread Mike Gargano
those are definitely all problems i am currently facing. it's fine if everything is sequestered off into it own model, but relationships between them are not going to happen unless you manually manage what relationship's object gets pulled into what context. it's not manageable for any real-wo

Re: Different Database Connection per session for the same model

2012-06-18 Thread Ramsey Gurley
Speaking of which, I wonder what migrations do for cross db fks? Does it blow up trying to form a constraint? I'll have to look sometime. Which raises another interesting issue. Do you create cross model relationships Larry? I could see that causing problems. For example, create an EO in common

Re: Different Database Connection per session for the same model

2012-06-18 Thread Larry Mills-Gahl
Let me be more clear. It is possible to run migrations automatically but the different databases (whose connection dictionary is only known inside a session) will not all be automatically updated. I have migrations turned on and automatically connecting to (and updating) an empty database that

Re: Different Database Connection per session for the same model

2012-06-18 Thread Mike Gargano
it is. this is what i'm basically doing to on a per session basis -mike Sent from my iPhone On Jun 18, 2012, at 2:53 PM, Henrique Prange wrote: > Paul, > > Maybe this project can be helpful. I created it following Chuck's advice. > It's very experimental, but works. Sorry for the lack of co

Re: Different Database Connection per session for the same model

2012-06-18 Thread Larry Mills-Gahl
Not automatically. Migrations happen during the application startup and at that point, they have default connection dictionary information. I do use migrations but that just migrates the common databases and an empty stub database (that uses the default connection dictionary) on the main db ser

Re: Different Database Connection per session for the same model

2012-06-18 Thread Chuck Hill
IIRC, it is not handled. On 2012-06-18, at 1:43 PM, Ramsey Gurley wrote: > Out of curiosity, do you happen to know if it's possible to run migrations > against multiple data stores like you have Larry? > > Ramsey > > On Jun 18, 2012, at 1:25 PM, Larry Mills-Gahl wrote: > >> I do have an app

Re: Different Database Connection per session for the same model

2012-06-18 Thread Ramsey Gurley
Out of curiosity, do you happen to know if it's possible to run migrations against multiple data stores like you have Larry? Ramsey On Jun 18, 2012, at 1:25 PM, Larry Mills-Gahl wrote: > I do have an app with a different database connection per session. This does > appear to be relatively unch

Re: Different Database Connection per session for the same model

2012-06-18 Thread Larry Mills-Gahl
I do have an app with a different database connection per session. This does appear to be relatively uncharted territory, but it has been working in production for a while and it has been working pretty well. This is not a high volume transactional application. I use two models in this setup. O

Re: Different Database Connection per session for the same model

2012-06-18 Thread Henrique Prange
Paul, Maybe this project can be helpful. I created it following Chuck's advice. It's very experimental, but works. Sorry for the lack of comments in the source code. https://github.com/hprange/multi-tenant-prototype Cheers, Henrique On 18/06/2012, at 15:13, Chuck Hill wrote: > I have never d

Re: Different Database Connection per session for the same model

2012-06-18 Thread Chuck Hill
I have never done this, but I think it can be done. You will need to create new EOModelGroups, load/copy the models from the default group, set the connection information, and create a new EOObjectStoreCoordinator from that new model group. You need to be very careful in your code (and in any

Re: Different Database Connection per session for the same model

2012-06-18 Thread Ramsey Gurley
You might find this helpful http://developer.apple.com/legacy/mac/library/#documentation/WebObjects/Enterprise_Objects/Connecting/Connecting.html#//apple_ref/doc/uid/TP30001011-CH210-BEDGBJJC Although some of the information there (providing multiple database channels) is wrong. databaseContext

Re: Different Database Connection per session for the same model

2012-06-18 Thread Mike Gargano
yes, look at chuck's book for fiddling with the connection dictionary Sent from my iPhone On Jun 18, 2012, at 12:32 PM, Paul Dunkler wrote: > Hi List, > > is there any way to have different database connections per session? I need > this in an application for giving the user the ability to ch

Different Database Connection per session for the same model

2012-06-18 Thread Paul Dunkler
Hi List, is there any way to have different database connections per session? I need this in an application for giving the user the ability to change between several different copies of the database to work on. I always tried to copy EOModels and so on, read some mails from the list but not re