EclipseLink MultiTenant and Spring Data JPA - @IdClass annotation required - Why? -
i'm developing multi-tenant (multi-schema) application using spring-data-jpa , eclipselink. when not using multi-tenant capabilities ok, jpa entity works charme , works 1 schema. when try activate multi-tenant adding folloqing annotation entity :
@multitenant(value=multitenanttype.table_per_tenant) @tenanttablediscriminator(type=tenanttablediscriminatortype.schema, contextproperty="eclipselink-tenant.id")
and restart application, following exception :
caused by: java.lang.illegalargumentexception: no @idclass attributes exist on identifiabletype [entitytypeimpl@15818739:crsmomijob [ javatype: class com.gpdati.momi.model.core.crsmomijob descriptor: relationaldescriptor(com.gpdati.momi.model.core.crsmomijob --> [databasetable(crs_momi_job)]), mappings: 7]]. there still may 1 or more @id or @embeddedid on type. @ org.eclipse.persistence.internal.jpa.metamodel.identifiabletypeimpl.getidclassattributes(identifiabletypeimpl.java:169) @ org.springframework.data.jpa.repository.support.jpametamodelentityinformation$idmetadata.<init>(jpametamodelentityinformation.java:170) @ org.springframework.data.jpa.repository.support.jpametamodelentityinformation.<init>(jpametamodelentityinformation.java:71) @ org.springframework.data.jpa.repository.support.jpaentityinformationsupport.getmetadata(jpaentityinformationsupport.java:65) @ org.springframework.data.jpa.repository.support.jparepositoryfactory.getentityinformation(jparepositoryfactory.java:146) @ com.gpdati.momi.jpa.multitenantjparepositoryfactory.gettargetrepository(multitenantjparepositoryfactory.java:30) @ org.springframework.data.jpa.repository.support.jparepositoryfactory.gettargetrepository(jparepositoryfactory.java:67) @ org.springframework.data.repository.core.support.repositoryfactorysupport.getrepository(repositoryfactorysupport.java:136) @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.getobject(repositoryfactorybeansupport.java:153) @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.getobject(repositoryfactorybeansupport.java:43) @ org.springframework.beans.factory.support.factorybeanregistrysupport.dogetobjectfromfactorybean(factorybeanregistrysupport.java:142) ... 79 more
it seems @id annotation on id field no more read spring-data @idclass annotation (i thought @idclass annotation required when using composite primary key, that's not case)
any clue? thanks!
here full entity code :
@entity @table(name="crs_momi_job") @multitenant(value=multitenanttype.table_per_tenant) @tenanttablediscriminator(type=tenanttablediscriminatortype.schema, contextproperty="eclipselink-tenant.id") public class crsmomijob implements serializable { private static final long serialversionuid = -432489894772l; private string abilitata; @column(name="hot_codice") private string hotcodice; @column(name="int_codice") private string intcodice; private long intervallo; private string note; private string parametri; @id private bigdecimal id; public crsmomijob() { } ... getters , setters ... }
seems bug in eclipselink meta model code in hassingleidattribute(), returning true (as id composite multitenants) should hidden, should returning false.
please log bug.
Comments
Post a Comment