Announcement Announcement Module
Collapse
No announcement yet.
UserConnection table when you have default schema Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Found it myself after a little more look at JdbcUsersConnectionRepository. You have to do repository.setTablePrefix("my_schema.")

    Comment


    • #3
      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.

      Comment


      • #4
        Ha...looks like my answer crossed paths with your own discovery of the same. Glad you figured it out!

        Comment

        Working...
        X