I am new to hibernate and have started using C3P0 as the connection pooling manager with hibernate because without that I was having timeout issues after 8 hours of no conta
Your application almost certainly is leaking Connections. See c3p0's docs for how to debug the problem.
TL; DR: Set
<property name="hibernate.c3p0.unreturnedConnectionTimeout">30</property>
<property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property>
Check your logs for stack traces that check out Connections or Sessions in your application but fail to reliably close() them. Fix that, by using something like try-with-resources to reliably close things. When you have fixed the problem, remove the above properties.
See also this