Defining datasource in resources.groovy

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Defining datasource in resources.groovy

SanjayGupta
Hi,
I an trying to define datasource bean in resources.groovy and that part works fine. But when i add the session factory bean it doesn't work. I don't get an error. I have enabled debugging on hibernate but don't see any error. It's just my database call don't return any results. I am using grails 1.0.5. See my resources.groovy below. I would really appreciate any help on this.
Thanks
Sanjay




import org.apache.commons.dbcp.BasicDataSource
import org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean;
import org.springframework.context.ApplicationContext;
// Place your Spring DSL code here
beans = {
    dataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) {
                driverClassName = "oracle.jdbc.OracleDriver"
                url = "jdbc:oracle:thin:@dv022demo2:1521:primal01"
                username = "grails"
                password = "grails"
                //pooled = "true"
        }
        sessionFactory(ConfigurableLocalSessionFactoryBean) {
              dataSource = dataSource
               hibernateProperties = ["hibernate.hbm2ddl.auto":"update",            
                                      "hibernate.show_sql":true,
                                      "hibernate.dialect":"org.hibernate.dialect.Oracle9iDialect",
                                      "hibernate.cache.use_second_level_cache":true,
                                      "hibernate.cache.use_query_cache":true,                                      "hibernate.ache.provider_class":"com.opensymphony.oscache.hibernate.OSCacheProvider"]
                                      //"hibernate.connection.provider_class":"com.bwse.vpd.MyConnectionProvider"]
        }
}
Reply | Threaded
Open this post in threaded view
|

RE: Defining datasource in resources.groovy

SanjayGupta
Hi,
Does anybody have any clue. I need to do this since I am trying to override a hibernate property.
Thanks
Sanjay

-----Original Message-----
From: SanjayGupta [mailto:[hidden email]]
Sent: Tuesday, August 18, 2009 3:19 PM
To: [hidden email]
Subject: [grails-user] Defining datasource in resources.groovy


Hi,
I an trying to define datasource bean in resources.groovy and that part
works fine. But when i add the session factory bean it doesn't work. I don't
get an error. I have enabled debugging on hibernate but don't see any error.
It's just my database call don't return any results. I am using grails
1.0.5. See my resources.groovy below. I would really appreciate any help on
this.
Thanks
Sanjay




import org.apache.commons.dbcp.BasicDataSource
import
org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean;
import org.springframework.context.ApplicationContext;
// Place your Spring DSL code here
beans = {
    dataSource(org.springframework.jdbc.datasource.DriverManagerDataSource)
{
                driverClassName = "oracle.jdbc.OracleDriver"
                url = "jdbc:oracle:thin:@dv022demo2:1521:primal01"
                username = "grails"
                password = "grails"
                //pooled = "true"
        }
        sessionFactory(ConfigurableLocalSessionFactoryBean) {
              dataSource = dataSource
               hibernateProperties = ["hibernate.hbm2ddl.auto":"update",            
                                      "hibernate.show_sql":true,
                                     
"hibernate.dialect":"org.hibernate.dialect.Oracle9iDialect",
                                     
"hibernate.cache.use_second_level_cache":true,
                                     
"hibernate.cache.use_query_cache":true,                                    
"hibernate.ache.provider_class":"com.opensymphony.oscache.hibernate.OSCacheProvider"]
                                     
//"hibernate.connection.provider_class":"com.bwse.vpd.MyConnectionProvider"]
        }
}

--
View this message in context: http://www.nabble.com/Defining-datasource-in-resources.groovy-tp25034523p25034523.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: Defining datasource in resources.groovy

Sean LeBlanc
Did you ever find an answer to your question? I'm wondering if finding a solution to your problem may help me in doing what I'm trying to do.

Cheers.