See PR #2837 for 5.0.x branch.
PRs for master and 5.1.x follow as soon as this PR gets approved.

> Am 10.08.2017 um 11:25 schrieb robertoschwald <robertoschw...@gmail.com>:
> 
> Shouldn't cause a problem, since Hibernate determines the sequence type 
> automatically on "native" in org.hibernate.dialect.Dialect.
> 
> I test and send in PRs for the 3 branches.
> 
> 
> On Wednesday, August 9, 2017 at 6:24:23 PM UTC+2, robertoschwald wrote:
> Hi all,
> 
> FYI.
> 
> 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 
> (https://mariadb.com/kb/en/mariadb/mariadb-galera-cluster-known-limitations/ 
> <https://mariadb.com/kb/en/mariadb/mariadb-galera-cluster-known-limitations/> 
> ). 
> 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 
> <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 
> https://vladmihalcea.com/2017/01/17/how-to-replace-the-table-identifier-generator-with-either-sequence-or-identity-in-a-portable-way/
>  
> <https://vladmihalcea.com/2017/01/17/how-to-replace-the-table-identifier-generator-with-either-sequence-or-identity-in-a-portable-way/>)
> - Create the hibernate_sequence table manually and provide a ID PK column 
> (nasty..)
> - Mark Galera as unsupported in CAS docs.
> 
> Robert
> 
> -- 
> 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 
> <mailto:cas-dev+unsubscr...@apereo.org>.
> Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/ 
> <https://groups.google.com/a/apereo.org/group/cas-dev/>.

-- 
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