Hmm could'nt we just use the spring jdbc template? Maybe just using, http://code.google.com/p/guiceyfruit/ ?
regards Nino 2010/3/7 Alen Vrečko <[email protected]> > Looks a bit complicated. My original implementation is locked away. > But from memory this is what I had in mind http://pastie.org/858152 > and test http://pastie.org/858153. No seal of approval thou. > > Maybe bklough can share their implementation. Sounds like they have a > polished jdbc support. > > HTH > Alen > > On Mar 7, 5:04 am, Kartik Kumar <[email protected]> wrote: > > I apologize in advance for the long winded email. By Alen's suggestion, I > > first tried to get a thread local connection instance to be injected. So > I > > first copied an implementation of ThreadLocalScope from Guice Custom > Scope > > implementationhttp://pastie.org/857790. > > Then I injected this scope into my ThreadLocalConnectionProvider to > inject > > the scope to provide initial seed value and to provide fall back > connection > > instancehttp://pastie.org/857829. To get a thread local connection > > instance, I call the scope method of my scope implementation. My modules > > binding is given here.http://pastie.org/857810. > > My unit tests work as in I get the same connection instance every time. > > My question is related to exception handling. I inject data source to any > > Provider that requires a connection. DataSource#getConnection() throws > > SQLException in its method signature. So in my get() implementation, I > have > > to swallow it or throw unchecked exception in its place as it I have done > in > > my example. I know that I can used ThrowingProviders, but scope method > does > > not allow an implementation of that interface as one of its method > argument. > > Is there a better way to do this write this implementation or am I stuck > > with what I have? > > > > Kartik > > > > On Tue, Mar 2, 2010 at 5:16 AM, Alen Vrečko <[email protected]> > wrote: > > > The @Retry just calls the method again if exception is thrown. Just > > > need to make sure the RetryInterceptor is the first one installed to > > > avoid any surprises. > > > > > In my case the database server got restarted from time to time. That > > > is nothing special but didn't want the Connection Pool to validate > > > connections all the time, therefore ConnectionClosedException happens. > > > But the @Retry just calls the method again, the CP is smart enough to > > > give a good connection the second time, and the user doesn't get en > > > error. > > > > > Cheers > > > Alen > > > > > On 1 mar., 16:46, Kartik Kumar <[email protected]> wrote: > > > > @Alen What is @Retry annotation? Was this one of the application > specific > > > > annotations that you implemented? > > > > > > On Sun, Feb 28, 2010 at 3:11 PM, Eelco Hillenius > > > > <[email protected]>wrote: > > > > > > > > Just curious, when would you not need a transaction? > > > > > > > I guess I should say that you don't always want to turn off > autocommit > > > > > (transaction per execution instead of per annotated method). And > > > > > thinking about it it, maybe there is no good reason. > > > > > > > Eelco > > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "google-guice" group. > > > > > To post to this group, send email to [email protected] > . > > > > > To unsubscribe from this group, send email to > > > > > [email protected]<google-guice%[email protected]> > <google-guice%[email protected]<google-guice%[email protected]> > > > > > <google-guice%2bunsubscr...@google groups.com> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/google-guice?hl=en. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "google-guice" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<google-guice%[email protected]> > <google-guice%[email protected]<google-guice%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-guice?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
