Hello, I'm super new to Fluent NHibernate, and ORMs in general; so maybe 
assume I don't know anything :D

How do I configure c3p0 checkoutTimeout, in Fluent NHibernate?

The app appears to be hanging when the DB server is offline, when it tries 
to run BuildSessionFactory. It sounds like I need to configure c3p0's 
checkoutTimeout, or else it will wait forever for the DB connection 
(https://forum.hibernate.org/viewtopic.php?p=2426663).

I failed to find any examples, and it looks like c3p0 has its own 
<c3p0-config> element, when you do it the XML way; so I'm not sure how I'm 
supposed to do that with Fluent NHibernate 
(https://webcache.googleusercontent.com/search?q=cache:ujHcueltIzoJ:https://www.appsloveworld.com/oracle/100/66/how-to-configure-c3p0-in-hibernate-to-auto-refresh-stale-db-connections&cd=11&hl=en&ct=clnk&gl=us).

Here's what the code looks like:

_sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2012
    .ConnectionString(GetConnectionString())
    .AdoNetBatchSize(22)
    .UseReflectionOptimizer())
    .Mappings(m => DatabaseHelper.BaseDbMappingsInMainDb.ForEach(db => m.
FluentMappings.Add(db)))
.ExposeConfiguration(config =>
{
    config.SetProperty("prepare_sql", "true");
    config.SetProperty("command_timeout", "30");
    config.SetProperty("default_flush_mode", "Commit"); // default: 
Unspecified
})
.BuildSessionFactory();

So, I can see how I would normaly set properties; but since checkoutTimeout 
is a property under the nested <c3p0-config> element (which seems to be 
nested under the normal config element), I doubt it's going to work if I 
just try to configure it directly.

(I am about to start experimenting with the code; but this is a weird 
little sub-app that runs within an installer; so it's not trivially easy 
for me to test this code out, at the moment.)

Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fluent-nhibernate/f442b0bc-2f7c-4a8c-85f9-742db0d17292n%40googlegroups.com.

Reply via email to