CAS 5 and 6, consent JDBC database name from "ConsentDecision" to "Consent_Decision" issue and fix

62 views
Skip to first unread message

Andy Ng

unread,
Mar 11, 2021, 11:26:55 PM3/11/21
to CAS Community
Hi all,

During migration from CAS 5 to CAS 6, I encountered an issue:
  • My consent table, originally called `ConsentDecision` , is now renamed to `Consent_Decision`
  • Moreover, the fields name is also changed, same pattern
We have found a solution and want to share here:
Add this here in case other encounter same issue, cheers!

Regards,
Andy

Pablo Vidaurri

unread,
Sep 11, 2021, 9:17:02 AM9/11/21
to CAS Community, Andy Ng
I'm having the opposite issue with CAS 6.3.2

My table and column names in db are snake_case.
My classes and properties are CamelCase.
Cas is simply lower casing the names and they are not found in the db

I have a custom database source that I want to use CamelCase to SnakeCase. So I created my own naming strategy class. But it is not being picked up.
custom.mydbsource.physical-naming-strategy-class-name=org.apereo.cas.hibernate.CustomSnakecasePhysicalNamingStrategy

In my DataSource setup, do I have to explicitly need to read this property and call a setter for it?

I do not wish to change the naming strategy for all my db sources especially for those used and maintained by CAS. I only want to use this custom naming strategy on my custom datasource.

-psv

Pablo Vidaurri

unread,
Sep 11, 2021, 9:58:22 AM9/11/21
to CAS Community, Pablo Vidaurri, Andy Ng
I was able to get this resolved by adding it as a property in my DB Configuration:

String namingStrategy = customProperties.getEbizdbsource().getPhysicalNamingStrategyClassName();
Properties properties = new Properties();
properties.setProperty("hibernate.physical_naming_strategy", namingStrategy);

Reply all
Reply to author
Forward
0 new messages