@Version with inheritance in java8 does not work

Description

when a base class marked with @MappedSuperclass has a @Version column and an entity inherits from it, hibernate raises the following exception (but only under jdk1.8.0):

at org.hibernate.jpa.internal.metamodel.AttributeFactory$6.resolveMember(AttributeFactory.java:1059)
at org.hibernate.jpa.internal.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:466)
at org.hibernate.jpa.internal.metamodel.AttributeFactory.buildVersionAttribute(AttributeFactory.java:176)
at org.hibernate.jpa.internal.metamodel.MetadataContext.applyVersionAttribute(MetadataContext.java:343)
at org.hibernate.jpa.internal.metamodel.MetadataContext.wrapUp(MetadataContext.java:248)
at org.hibernate.jpa.internal.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:96)
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:148)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:867)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:67)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:257)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 66 more

following sample mapping:

@MappedSuperclass
public abstract class BaseEntity implements Persistable
{

private static final long serialVersionUID = SerialVersion.SERIAL_VER;

private Date modified;
private Date created;
private String modifiedBy;

@Column(name = "MODIFIED")
@Temporal(TemporalType.TIMESTAMP)
@Version
public Date getModified()
{
return modified;
}
...

@Table(name = "CSF_PRICES")
@Entity
public class ContractServiceFeaturePriceEntity extends BaseEntity
{

private static final long serialVersionUID = SerialVersion.SERIAL_VER;
public static final String SEQ_NAME = "SEQ_CSF_PRICES";

@Id
@Column(name = "CSFP_ID", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQ_NAME)
@org.hibernate.annotations.GenericGenerator(name = SEQ_NAME, strategy = "sequence", parameters = { @Parameter(name = "sequence", value = SEQ_NAME) })
private Long id;

...

Environment

jdk1.8.0_66, eclipse 4.4.2

Assignee

Gail Badner

Reporter

Christian Schmitz

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure