Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ability to use @Transient with @Temporal #194

Closed
alexbudarov opened this issue Jun 16, 2021 · 0 comments
Closed

Port ability to use @Transient with @Temporal #194

alexbudarov opened this issue Jun 16, 2021 · 0 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@alexbudarov
Copy link

This example entity fails to be enhanced in Jmix:

@JmixEntity
@Table(name = "PRODUCT")
@Entity
public class Product {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @JmixProperty
    @Transient
    @Temporal(TemporalType.DATE)
    private Date refreshTs;

    @Column(name = "NAME")
    private String name;

    @Column(name = "PRICE", precision = 19, scale = 2)
    private BigDecimal price;
// ...
}

Error:

Exception in thread "main" Local Exception Stack: 
Exception [EclipseLink-40007] (Eclipse Persistence Services - 2.7.7.2-jmix): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: [Ljava.lang.String;@6631f5ca
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.7.2-jmix): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [main] failed.
Internal Exception: Exception [EclipseLink-7153] (Eclipse Persistence Services - 2.7.7.2-jmix): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Mapping annotations cannot be applied to fields or properties that have a @Transient specified. [field refreshTs] is in violation of this restriction.
	at org.eclipse.persistence.exceptions.StaticWeaveException.exceptionPerformWeaving(StaticWeaveException.java:140)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.main(StaticWeave.java:88)

In CUBA we had a patch in EclipseLink and com.haulmont.cuba.core.sys.persistence.EclipseLinkCustomizer#initTransientCompatibleAnnotations method on server to make use of it.

Alternative solution: restrict Studio's entity designer to make impossible to create such transient attribute.

@alexbudarov alexbudarov added the type: bug Something isn't working label Jun 16, 2021
@alexbudarov alexbudarov added this to the 1.0.0 milestone Jun 16, 2021
andreysubbotin added a commit to cuba-platform/eclipselink that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-gradle-plugin that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-bom that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-bom that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-gradle-plugin that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-templates that referenced this issue Jun 22, 2021
andreysubbotin added a commit to jmix-projects/jmix-templates that referenced this issue Jun 22, 2021
@lovtsovaik lovtsovaik assigned owlet1997 and unassigned lovtsovaik Jun 23, 2021
dtaimanov pushed a commit to cuba-platform/eclipselink that referenced this issue Nov 16, 2021
dtaimanov added a commit to jmix-framework/eclipselink that referenced this issue Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants