Hi all,


Currently CAS (5.x) does not play well with Galera db cluster when using 
JPA registries.

In Galera, each table must hold a PK to support deletes (
Therefore, it is mandatory to set the MariaDB option 
"innodb_force_primary_key=1“, to ensure all tables hold a primary key.

As the CAS Entity IDs are annotated with @GeneratedValue(strategy = 
GenerationType.AUTO), Hibernate (5.x) picks the table generator instead of 
identity, so tries to create the hibernate_sequence table in DDL.
See https://hibernate.atlassian.net/browse/HHH-11014

As the hibernate_sequence table does not have a PK, creation fails in 
Galera with: java.sql.SQLSyntaxErrorException: This table type requires a 
primary key.
Also, performance is quite bad in MySQL, as the table generator uses an 
additional, separate transaction to fetch a sequence value.

There are several approaches to workaround this issue:

- Set generator=„native“ in @GeneratedValue
- Change strategy to „SEQUENCE“ by default and provide a JPA XML mapping 
that overwrites the Java based annotation mapping (see 
- Create the hibernate_sequence table manually and provide a ID PK column 
- Mark Galera as unsupported in CAS docs.


You received this message because you are subscribed to the Google Groups "CAS 
Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-dev+unsubscr...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.

Reply via email to