Not sure if this is according to the EJB3 spec or not..
Running the following code with annotations alpha 2:
Code:
import javax.ejb.Entity;
import javax.ejb.Id;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
public class Test
{
public static class TestId
{
private Long id;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
}
@Entity
public static class TestEntity extends TestId
{
@Id
public Long getId()
{
return super.getId();
}
}
public static void main(String[] args)
{
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass(TestEntity.class);
SessionFactory factory = config.buildSessionFactory();
}
}
Results in the exception:
Code:
org.hibernate.MappingException: Repeated column in mapping for entity: Test$TestEntity column: id (should be mapped with insert="false" update="false")
It obviously works fine if @Id is declared on TestId and not overridden in TestEntity, but this seems to be a problem common to any persistent property with an overridden accessor.