[Lift] Re: Multi-Database Transactions

2009-12-09 Thread deadfolk
As Jeppe says, I'm avoiding XA..

This is because when we tried it in a Java project, we had a problem
where connections were dropped over time and no new ones could be
created.  Luckily this never got past our test system.  We were unable
to recreate it and so could never verify any fix.

After that, we decided not to rely on any transaction 'magic'.  If
it's broke, we need to be able to fix it ourselves.  Our requirements
are pretty simple, so I think we can do what was suggested here, and
add any addidional logic ourselves.  Anything crossing both DBs would
be stats related, and so losing the occasional row would not be an
issue.


On Dec 9, 1:56 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Dec 9, 2009 at 12:09 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

  On Wed, Dec 9, 2009 at 5:05 AM, David Pollak
  feeder.of.the.be...@gmail.com wrote:
   I think what you want is the Lift JTA module:

  http://github.com/dpp/liftweb/tree/master/lift-modules/lift-jta/

  I think the OP wanted to avoid XA transactions. But of course, if data
  integriity is important this is the right way to go.

  I haven't looked at lift-jta. Does it provide something else besides
  hooking into JTA that would be useful in this scenario?

 Dunno... it's Jonas's brainchild. ;-)





  /Jeppe

  --

  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Re: Multi-Database Transactions

2009-12-08 Thread deadfolk
Hi Jeppe - thanks for your response.

So, am I correct in saying that I just need to do something like
this?  (not tested code - just an approximation)

//Assuming fooDb and barDb are some form of connection wrapper...

S.addAround(List(new LoanWrapper {
  def apply[T](f: = T): T = {
fooDb.begin
barDb.begin
try {
  val result = f
  barDb.commit
  fooDb.commit
  result
}
catch {
  case e = {
barDb.rollback
fooDb.rollback
  }
}
  }
}))

On Dec 2, 11:56 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 deadfolk deadf...@gmail.com writes:

 [...]

  I'll likely be using plain JDBC or JPA.  What would be my options in
  Lift?  Can I get a list of connections and just use a filter (or
  equivalent) to begin/commit/rollback on each within every request?
  I've done some searching, but I've not found anything relating to the
  use of multiple databases.

  Any advice/pointers would be very much appreciated.

 Lift already supports wrapping the request with code. e.g I have    

 S.addAround(DB.buildLoanWrapper)

 in Boot.scala which wraps a transaction around the request.

 I haven't tried multiple databases, but it should be trivial (famous
 last words :-) to extend this to also work in this scenario (when you
 don't want XA transactions)

 This is for Mapper, the Lift ORM, I assume JPA can be made to work in
 similar ways...

 /Jeppe

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Re: JSON Reponses

2009-12-04 Thread deadfolk
Wow - thanks for the reponses, guys!  Plenty to look at here.

Doesn't look like I should be concerned about support for Lift.  If
only some of the commercial support contracts we have were as helpful.



On Dec 3, 7:17 pm, Ross Mellgren dri...@gmail.com wrote:
 Views are for providing template XML, I believe, and so are still  
 using NodeSeq and wouldn't address the problem.

 Looking at the type of LiftRules.viewDispatch seems to imply that, at  
 least.

 -Ross

 On Dec 3, 2009, at 1:59 PM, Daniel Nelson wrote:

  Hi Matt,

  I'm pretty new/novice myself, but I believe you do this through View
  instead of Snippet.

  Don't forget to add the specific View page to Sitemap otherwise it
  won't be accessible when you call it.

  Hope this is accurate / helpful.

  Dan

  On Dec 3, 11:06 am, deadfolk deadf...@gmail.com wrote:
  Hi all,

  I'm still at the evaluation stage of Lift, so please forgive my
  ignorance, but I cannot figure out how to render any non-XML  
  reponses.

  I'm looking to create a simple web service which can send reponses
  back in either XML or JSON.  I have the XML side covered, but I can't
  figure out how to send a JSON response back.  Snippets take a NodeSeq
  and return a NodeSeq, so unless I'm missing something here, they are
  only good for XML.

  I've found various posts on JSON, but they all seem to relate to  
  forms
  and AJAX, whereas all I really want to be able to do is render JSON
  instead of XML.

  Any pointers greatly appreciated,

  Matt

  --

  You received this message because you are subscribed to the Google  
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com
  .
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en
  .

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] JSON Reponses

2009-12-03 Thread deadfolk
Hi all,

I'm still at the evaluation stage of Lift, so please forgive my
ignorance, but I cannot figure out how to render any non-XML reponses.

I'm looking to create a simple web service which can send reponses
back in either XML or JSON.  I have the XML side covered, but I can't
figure out how to send a JSON response back.  Snippets take a NodeSeq
and return a NodeSeq, so unless I'm missing something here, they are
only good for XML.

I've found various posts on JSON, but they all seem to relate to forms
and AJAX, whereas all I really want to be able to do is render JSON
instead of XML.

Any pointers greatly appreciated,

Matt

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Multi-Database Transactions

2009-12-02 Thread deadfolk
Hi all,

I'm currently evaluating Lift for a new project I'll be working on
soon, and I'm looking for a little input regarding if/how I can manage
transactions across two databases.

It's going to be a bunch of web services over two MySQL databases.
I'll need to synchronize transactions across the two, but I won't be
using XA, as we've had some problems in this area.  I don't know if
it's us, drivers, JBoss, MySQL server itself or what, but we're
steering clear regardless, as the problems are nasty and difficult to
reproduce.

I'm not concerned about 2PC or anything of that sort.  If we have a
commit/rollback problem once in a blue moon, I'm not going to lose any
sleep over it.  What I've done in an existing Java/Spring project is
to write a class that contains a list of Spring's transaction managers
and just delegates begin/commit/rollback as appropriate.

I'll likely be using plain JDBC or JPA.  What would be my options in
Lift?  Can I get a list of connections and just use a filter (or
equivalent) to begin/commit/rollback on each within every request?
I've done some searching, but I've not found anything relating to the
use of multiple databases.

Any advice/pointers would be very much appreciated.

Matt

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.