Community
Participate
Working Groups
Suppose we have a class @Entity class SampleWithPrimitiveId { @Id long id; } Trying to lookup the id property through IdentifiableType type = // … type.getId(type.getIdType().getJavaType()) fails with Expected id attribute type [class java.lang.Long] on the existing id attribute [SingularAttributeImpl[BasicTypeImpl@1973147899:long [ javaType: long],org.eclipse.persistence.mappings.DirectToFieldMapping[id-->SAMPLEWITHPRIMITIVEID.ID]]] on the identifiable type [EntityTypeImpl@1313610571:SampleWithPrimitiveId [ javaType: class org.springframework.data.jpa.domain.sample.SampleWithPrimitiveId descriptor: RelationalDescriptor(org.springframework.data.jpa.domain.sample.SampleWithPrimitiveId --> [DatabaseTable(SAMPLEWITHPRIMITIVEID)]), mappings: 1]] but found attribute type [long]. I'll prepare a reproducing branch in Spring Data JPA. I can currently only test that against 2.4.0 as both 2.4.2 and 2.5.0 fail to bootstrap due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=411560.
Steps to reproduce: git clone https://github.com/SpringSource/spring-data-jpa cd spring-data-jpa git checkout eclipselink-415027 mvn clean test The EclipseLink version is held in a property in the pom.xml so it should be easy to test that running against more recent versions as well.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
Having the same problem when using MapsId: [CODE] @Entity @Table(name = "etl_servidor_publico", schema = "sapeo") public class EtlServidorPublico implements Serializable { @Id @Column(name = "nomeacao_id") private Long id; @MapsId @OneToOne(optional = false) @JoinColumn(name = "nomeacao_id", nullable = false, updatable = false) private Nomeacao nomeacao; [/CODE] The exception: [CODE] java.lang.IllegalArgumentException: Expected id attribute type [class java.lang.Long] on the existing id attribute [SingularAttributeImpl[EntityTypeImpl@535754249:Nomeacao [ javaType: class br.gov.to.secad.sapeo.model.Nomeacao descriptor: RelationalDescriptor(br.gov.to.secad.sapeo.model.Nomeacao --> [DatabaseTable(sapeo.nomeacao)]), mappings: 12],org.eclipse.persistence.mappings.OneToOneMapping[nomeacao]]] on the identifiable type [EntityTypeImpl@22731072:EtlServidorPublico [ javaType: class br.gov.to.secad.sapeo.model.EtlServidorPublico descriptor: RelationalDescriptor(br.gov.to.secad.sapeo.model.EtlServidorPublico --> [DatabaseTable(sapeo.etl_servidor_publico)]), mappings: 19]] but found attribute type [class br.gov.to.secad.sapeo.model.Nomeacao]. [/CODE] Tested against 2.4.0, 2.4.2 and 2.5.0.
I have the same problem with EclipseLink 2.5.2.
Also in 2.6.0
Same Problem in 2.7.1. Occurred for me when I changed the @Id type of an entity from java.lang.Long to long. There's nothing special about the entity, however, it is part of a @OneToMany/@ManyToOne relation (the entity where it occurs holds the owning @ManyToOne side). Does anyone know why this is happening? Workarounds?
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink