DATAREST-44 Fix for situation where EclipseLink throws an exception if no version is present on the entity.

This commit is contained in:
Jon Brisbin
2012-09-05 14:50:31 -05:00
committed by Jon Brisbin
parent e3dde1a2cd
commit 2c710b5978

View File

@@ -31,8 +31,12 @@ public class JpaEntityMetadata implements EntityMetadata<JpaAttributeMetadata> {
public JpaEntityMetadata(Repositories repositories, EntityType<?> entityType) {
type = entityType.getJavaType();
idAttribute = new JpaAttributeMetadata(entityType, entityType.getId(entityType.getIdType().getJavaType()));
if(null != entityType.getVersion(Long.class)) {
versionAttribute = new JpaAttributeMetadata(entityType, entityType.getVersion(Long.class));
try {
if(null != entityType.getVersion(Long.class)) {
versionAttribute = new JpaAttributeMetadata(entityType, entityType.getVersion(Long.class));
}
} catch(IllegalArgumentException ignored) {
// No version exists, just ignore it
}
for(Attribute attr : entityType.getAttributes()) {