Results 1 to 4 of 4

Thread: UserConnection table when you have default schema

  1. #1

    Default UserConnection table when you have default schema

    Hi All,

    I have a grails app where I integrated with Spring Social and it was working fine. It started throwing error once I introduced a default schema in DataSource.groovy.
    Code:
    hibernate {
        cache.use_second_level_cache = true
        cache.use_query_cache = false
        cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
        default_schema = "my_schema"
        generate_statistics = true
    }
    When I looked at the code which was working before, I found that UserConnection table was getting created under public schema. Now since I had specified default_schema it got created in 'my_schema'.

    But, the sql getting generated to fetch the user connection is not adapting and it throws up an error.
    Code:
    Class
    org.h2.jdbc.JdbcSQLException
    Message
    Table "USERCONNECTION" not found; SQL statement: select userId from UserConnection where providerId = ? and providerUserId = ? [42102-164]
    Any suggestions on how to solve this?

  2. #2

    Default

    Found it myself after a little more look at JdbcUsersConnectionRepository. You have to do repository.setTablePrefix("my_schema.")

  3. #3
    Join Date
    Aug 2004
    Posts
    1,074

    Default

    JdbcConnectionFactory has a tablePrefix property. It's an empty string by default, but you can set it to a schema name if you want. Perhaps setting it to "my_schema." will fix your problem.
    Craig Walls
    Spring Social Project Lead

  4. #4
    Join Date
    Aug 2004
    Posts
    1,074

    Default

    Ha...looks like my answer crossed paths with your own discovery of the same. Glad you figured it out!
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •