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

EntityMetamodel instantiation fails on Blaze-persist Alpha4 #518

Closed
jwgmeligmeyling opened this issue Feb 22, 2018 · 6 comments
Closed

EntityMetamodel instantiation fails on Blaze-persist Alpha4 #518

jwgmeligmeyling opened this issue Feb 22, 2018 · 6 comments
Assignees
Milestone

Comments

@jwgmeligmeyling
Copy link
Collaborator

EntityMetamodel instantiation fails on Blaze-persist Alpha4. In this case it fails on finding the id property of a referenced type for which the id property is defined in the super class.

(PartnerDiscountCode references GlobalPartner which extends Partner which has the id property).

The stack trace is as follows:

org.hibernate.QueryException: could not resolve property: partner.id of: com.pallasathenagroup.entities.PartnerDiscountCode

	at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:62)
	at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:56)
	at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyType(AbstractEntityPersister.java:4579)
	at com.blazebit.persistence.impl.hibernate.HibernateJpaProvider.isForeignJoinColumn(HibernateJpaProvider.java:275)
	at com.blazebit.persistence.impl.EntityMetamodelImpl$AttributeEntry.<init>(EntityMetamodelImpl.java:505)
	at com.blazebit.persistence.impl.EntityMetamodelImpl.<init>(EntityMetamodelImpl.java:112)
	at com.blazebit.persistence.impl.CriteriaBuilderFactoryImpl.<init>(CriteriaBuilderFactoryImpl.java:106)
	at com.blazebit.persistence.impl.CriteriaBuilderConfigurationImpl.createCriteriaBuilderFactory(CriteriaBuilderConfigurationImpl.java:601)
	at com.pallasathenagroup.entitymanagers.AbstractEntityManagerTest.initializeEntityManagerFactory(AbstractEntityManagerTest.java:71)

Description

Expected behavior

Actual behavior

Steps to reproduce

Environment

Version: 1.2.0-alpha4
JPA-Provider: Hibernate 5.2.12
DBMS: Postgresql 9.5
Application Server: Wildfly 10

@beikov beikov self-assigned this Feb 22, 2018
@beikov beikov added this to the 1.2.0 milestone Feb 22, 2018
@beikov
Copy link
Member

beikov commented Feb 22, 2018

Thanks, gonna take a look at that later today.

@beikov
Copy link
Member

beikov commented Feb 22, 2018

Could you maybe explain the mapping to me? I used the following and the model build succeeded.

    @Entity
    public static class PartnerDiscountCode {
        @Id
        @GeneratedValue
        private Long id;
        @JoinColumn(name = "partner_id")
        @ManyToOne(fetch = FetchType.LAZY)
        private GlobalPartner partner;

    }

    @Entity
    public static abstract class Partner {
        @Id
        private Long id;
    }

    @Entity
    public static class GlobalPartner extends Partner {
    }

@jwgmeligmeyling
Copy link
Collaborator Author

@jwgmeligmeyling
Copy link
Collaborator Author

Perhaps the table per class inheritance strategy?

@beikov
Copy link
Member

beikov commented Feb 22, 2018

Thanks, have a reproducer now. Investigating the reasons now.

beikov added a commit to beikov/blaze-persistence that referenced this issue Feb 22, 2018
@beikov beikov closed this as completed Feb 22, 2018
@jwgmeligmeyling
Copy link
Collaborator Author

jwgmeligmeyling commented Feb 22, 2018

Thanks! 👍 Will verify the patch on my test suite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants