Hey Graham, I can't jump in with the enhancement issue, but maybe it is worth to send a message to the OpenJPA list.
In my opinion there is no need to replace the Hibernate validator because it uses a different license then Hibernate ORM. It is dual licensed under Apache v2. Cheers Markus Ebenezer Graham <[email protected]> schrieb am So., 5. Mai 2019, 09:04: > Hello Fineracters, > > I am migrating the project's ORM from Hibernate to OpenJPA and I want to > use this thread to discuss issues related to it. > > I have started building on the progress made by Isaac Kamga and I am > currently changing the ORM to connect to PostgreSQL. > > I am working on the migration in this order > 1. Postgres Library - > https://github.com/ebenezergraham/fineract-cn-postgresql/commit/c10a1e77c3a290c1faa671621baf6c6037ba260a > 2. Provisioner Service - > https://github.com/ebenezergraham/fineract-cn-provisioner/tree/FINCN-2 > 3. Customer Service - > https://github.com/ebenezergraham/fineract-cn-customer/tree/FINCN-2 > > *Entity enhancement blocker* > I would like to know if anyone has experience on how to dynamically > enhance entity classes for OpenJPA. Unlike hibernate, OpenJPA requires > entity classes to be enhanced for monitoring purposes (read more here > http://openjpa.apache.org/entity-enhancement.html). OpenJPA does not > provide documentation on how to configure the enhancement with spring or > gradle. I would appreciate it if someone could share their experience on > how to handle this (a better way of doing this > https://openjpa.apache.org/enhancement-with-maven.html with gradle or a > plugin). > > The above issue has led to this error(full log here: > https://pastebin.com/kGQu4qLH) > > Error creating bean with name 'jpaMappingContext': Invocation of init >> method failed; nested exception is <openjpa-2.4.1-r422266:1730418 fatal >> user error> org.apache.openjpa.util.MetaDataException: The type "class >> org.apache.fineract.cn.customer.internal.repository.PortraitEntity" has not >> been enhanced. > > > *Issues Removing Hibernate Validator* > OpenJPA and Javax validation combined does not provide all of the > validations supported by Hibernate. I believe this is why the hibernate > validator was used in the first place. However, there are a few cases eg: > @NotBlank and @ScriptAssert used in Anubis > https://github.com/ebenezergraham/fineract-cn-anubis/blob/b454a2729c5044a310413c4ce938b3760bb417c9/api/src/main/java/org/apache/fineract/cn/anubis/api/v1/domain/PermittableEndpoint.java#L29 > . > > The approach I have taken is to write new validators to complement Javax > validators. eg: A custom NotBlank validator in the Lang Library: > https://github.com/ebenezergraham/fineract-cn-lang/commit/efb00532d3ae2ed5a24dac154c52d7581f27539f. > Even though these validations are a few, I am not convinced of how it will > scale. I'm open to suggestions. > > PS: I noticed that the out/ directory has not been ignored. Is there a > special reason for this? If not, I will add them to the .gitignore file as > I make the migrations in each service. This is because new contributors > might mistakenly push compiled code onto GitHub. > > Looking forward to hearing from you. > > Warm Regards, > Graham. >
