Possible bug when making a change in the data model

Greetings, everyone. When I make a change in my data model, no matter how small, either in the view or in a field, and restart the “compileJava” task, it generates an error which forces me to completely clean the display and run it again. I don’t understand what makes it generate, if you can help me I appreciate it. It’s worth mentioning that it’s a project with Kotlin 1.3.70

> Task :het-global:compileJava FAILED
Exception in thread "main" Local Exception Stack: 
Exception [EclipseLink-40007] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: [Ljava.lang.String;@57250572
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [yarg-email-template-addon] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class com.treze.sw.het.entity.catalogs.generals.InternationalMarketer] uses a non-entity [class com.treze.sw.het.entity.catalogs.generals.InternationalSmsTemplate] as target entity in the relationship attribute [field smsTemplates].
	at org.eclipse.persistence.exceptions.StaticWeaveException.exceptionPerformWeaving(StaticWeaveException.java:140)
	at org.eclipse.persistence.tools.weaving.jpa.CubaStaticWeave.main(CubaStaticWeave.java:37)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.EntityManagerSetupException
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.EntityManagerSetupException

Exception Description: Predeployment of PersistenceUnit [yarg-email-template-addon] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class com.treze.sw.het.entity.catalogs.generals.InternationalMarketer] uses a non-entity [class com.treze.sw.het.entity.catalogs.generals.InternationalSmsTemplate] as target entity in the relationship attribute [field smsTemplates].
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:2104)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2080)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveClassTransformer.buildClassTransformers(StaticWeaveClassTransformer.java:128)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveClassTransformer.<init>(StaticWeaveClassTransformer.java:78)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.process(StaticWeaveProcessor.java:252)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.performWeaving(StaticWeaveProcessor.java:174)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.start(StaticWeave.java:117)
	at org.eclipse.persistence.tools.weaving.jpa.CubaStaticWeave.main(CubaStaticWeave.java:35)
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.EntityManagerSetupException
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.EntityManagerSetupException

Exception Description: Predeployment of PersistenceUnit [yarg-email-template-addon] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class com.treze.sw.het.entity.catalogs.generals.InternationalMarketer] uses a non-entity [class com.treze.sw.het.entity.catalogs.generals.InternationalSmsTemplate] as target entity in the relationship attribute [field smsTemplates].
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:233)
	... 8 more
Caused by: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.ValidationException
Caused by: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.ValidationException

Exception Description: [class com.treze.sw.het.entity.catalogs.generals.InternationalMarketer] uses a non-entity [class com.treze.sw.het.entity.catalogs.generals.InternationalSmsTemplate] as target entity in the relationship attribute [field smsTemplates].
	at org.eclipse.persistence.exceptions.ValidationException.nonEntityTargetInRelationship(ValidationException.java:1383)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor.getReferenceDescriptor(RelationshipAccessor.java:569)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor.getOwningMapping(RelationshipAccessor.java:485)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToManyAccessor.processOneToManyMapping(OneToManyAccessor.java:217)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToManyAccessor.process(OneToManyAccessor.java:150)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processNonOwningRelationshipAccessors(MetadataProject.java:1652)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1941)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:584)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:629)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2001)
	... 6 more

Execution failed for task ':het-global:compileJava'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1

Regards,

Nelson F.

Hi,

This error happens during entity enhancing - it is a process of changing byte code of entities which occurs during code compilation. When doing enhancing, EclipseLink ORM also validates that your data model is correct.
The error message tells you what is wrong with your code:

class com.treze.sw.het.entity.catalogs.generals.InternationalMarketer] 
uses a non-entity 
[class com.treze.sw.het.entity.catalogs.generals.InternationalSmsTemplate] 
as target entity in the relationship attribute [field smsTemplates].

So you should check your InternationalMarketer class.
Also check that InternationalSmsTemplate class is registered along with other entities in persistence.xml file of your project (if it is an entity).

Thank you @AlexBudarov for your answer. I completely reviewed the project and everything is correct in theory, what I notice is that if I make an adjustment or change in my entities then the one that was modified marks that error.

You can see the image of my persistence.xml
image

Hi,
OK, I see that both entities are in the same persistence.xml file, this is how it should be.

Not sure I have understood you.

Can you attach source code of both entities that are mentioned in the eclipselink enhancing error message?

Can you attach also your build.gradle build script file? Do you use Kotlin for your entities?

The problem may be related to your project configuration, attached libraries or annotation processors, source sets, additional datastores or other local specifics.
It’s hard to advice anything. But if you will be able to reproduce the problem on a small sample project, CUBA team will investigate it.