JPA, Hibernate, c3p0

60 views
Skip to first unread message

Ryan Donahue

unread,
Jun 26, 2009, 8:43:39 AM6/26/09
to Lift
I'm using JPA and Hibernate for persistence, and I've configured
Hibernate to use c3p0 for connection pooling. I'm using scalajpa as
follows:

object em extends LocalEMF(persistenceUnit) with ThreadLocalEM

When Tomcat reloads the app, the following is logged:

"A C3P0Registry mbean is already registered. This probably means that
an application using c3p0 was undeployed, but not all
PooledDataSources were closed prior to undeployment. This may lead to
resource leaks over time. Please take care to close all
PooledDataSources."

So I thought I would just add a function to LiftRules.unloadHooks to
close the EntityManagerFactory, however I can't find any way to access
the underlying factory. LocaEMF has an emf val, but it is private.

Any ideas?

Derek Chen-Becker

unread,
Jun 26, 2009, 11:20:49 AM6/26/09
to lif...@googlegroups.com
I'll look at adding a hook.

Derek

Ryan Donahue

unread,
Jun 29, 2009, 12:57:57 PM6/29/09
to Lift
Thanks, there's no rush. I'm starting a week-long vacation tomorrow,
so I wouldn't be able to try any changes until then anyway.

On Jun 26, 11:20 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote:
> I'll look at adding a hook.
>
> Derek
>

Ryan Donahue

unread,
Jul 9, 2009, 4:05:31 PM7/9/09
to Lift
Hi Derek, just wondering if you've had a chance to look at this yet?

On Jun 29, 12:57 pm, Ryan Donahue <donahu...@gmail.com> wrote:
> Thanks, there's no rush.  I'm starting a week-long vacation tomorrow,
> so I wouldn't be able to try any changes until then anyway.
>
> On Jun 26, 11:20 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote:
>
> > I'll look at adding a hook.
>
> > Derek
>
> > On Fri, Jun 26, 2009 at 6:43 AM, Ryan Donahue <donahu...@gmail.com> wrote:
>
> > > I'm using JPA and Hibernate for persistence, and I've configured
> > > Hibernate to usec3p0for connection pooling.  I'm using scalajpa as
> > > follows:
>
> > > object em extends LocalEMF(persistenceUnit) with ThreadLocalEM
>
> > > When Tomcat reloads the app, the following is logged:
>
> > > "A C3P0Registry mbean is already registered. This probably means that
> > > an application usingc3p0was undeployed, but not all

Derek Chen-Becker

unread,
Jul 9, 2009, 5:14:20 PM7/9/09
to lif...@googlegroups.com
Whoops. Forgot about this one. I just pushed a fix in scalajpa 1.2-SNAPSHOT that adds a shutdown method to LocalEMF. Please let me know if that works as expected or if there are any other issues.

Derek

Ryan Donahue

unread,
Jul 9, 2009, 5:16:54 PM7/9/09
to lif...@googlegroups.com
Thanks, I'll try it tomorrow and let you know.

Ryan Donahue

unread,
Jul 10, 2009, 12:57:30 PM7/10/09
to Lift
The shutdown method works. Thanks.

On Jul 9, 5:16 pm, Ryan Donahue <donahu...@gmail.com> wrote:
> Thanks, I'll try it tomorrow and let you know.
>
> On Thu, Jul 9, 2009 at 5:14 PM, Derek Chen-Becker<dchenbec...@gmail.com> wrote:
> > Whoops. Forgot about this one. I just pushed a fix in scalajpa 1.2-SNAPSHOT
> > that adds a shutdown method to LocalEMF. Please let me know if that works as
> > expected or if there are any other issues.
>
> > Derek
>
Reply all
Reply to author
Forward
0 new messages