Hi, Does anyone knows how to manage transactions in RoR. Thanx
On May 16, 2006, at 12:18 AM, Ovidiu EFTIMIE wrote:> Does anyone knows how to manage transactions in RoR.http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ ClassMethods.html -- -- Tom Mornini
You can''t do transactions over multiple databases though. Tom Mornini wrote:> On May 16, 2006, at 12:18 AM, Ovidiu EFTIMIE wrote: > >> Does anyone knows how to manage transactions in RoR. > > http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ > ClassMethods.html > > -- > -- Tom Mornini-- Posted via http://www.ruby-forum.com/.
Kris- At this point, to my knowledge, there isn''t a shabam! sort of way to do multiple database transactions in a super clean way. But, there are two ''hackish'' solutions. If your database has inline transaction handling then just use the facilities to write your own SQL to one db to perform the transaction on both. (Some dbs can do this). You can also nest your transactions. Its not perfect, nor is it pretty, but as long as each model has a seperate connection, then you are cool. Check out the API for "transaction". -hampton. On 5/16/06, Kris <kris@alternativefocusmedia.com> wrote:> > You can''t do transactions over multiple databases though. > > > Tom Mornini wrote: > > On May 16, 2006, at 12:18 AM, Ovidiu EFTIMIE wrote: > > > >> Does anyone knows how to manage transactions in RoR. > > > > http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ > > ClassMethods.html > > > > -- > > -- Tom Mornini > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060516/ec4b5bf2/attachment.html
On 5/16/06, Hampton <hcatlin@gmail.com> wrote:> Kris- > > At this point, to my knowledge, there isn''t a shabam! sort of way to do > multiple database transactions in a super clean way. > > But, there are two ''hackish'' solutions. If your database has inline > transaction handling then just use the facilities to write your own SQL to > one db to perform the transaction on both. (Some dbs can do this). > > You can also nest your transactions. Its not perfect, nor is it pretty, but > as long as each model has a seperate connection, then you are cool. > > Check out the API for "transaction". > > -hampton.I''d say you''re better off with Java for distributed transactions. In these SOA-times you could still do the web tier in Rails, though. Isak
Hopefully JRuby will allow us to connect to a Java backend at some point in the future. When you say SOA, you mean a web service? So you would have a the Rails app connect to a Java web service, passing one or more records. The Java app would do the transaction and respond with OK or Fail?? Would you have just the database stuff in Java or the models as well? Isak Hansen wrote:> On 5/16/06, Hampton <hcatlin@gmail.com> wrote: >> as long as each model has a seperate connection, then you are cool. >> >> Check out the API for "transaction". >> >> -hampton. > > I''d say you''re better off with Java for distributed transactions. In > these SOA-times you could still do the web tier in Rails, though. > > Isak-- Posted via http://www.ruby-forum.com/.