From 900918fa5404a73d7c95dc4dbb48a1358e45301b Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 22 Jun 2018 11:45:10 +0200 Subject: [PATCH] #2 - Use java.lang.Long as fallback Id type. We now use java.lang.Long as fallback Id type for entities that do not declare an explicit Id property. Previously we used ObjectId which was a left-over from the initial draft of MappingRelationalEntityInformation. --- .../repository/query/RelationalEntityInformation.java | 2 +- .../support/MappingRelationalEntityInformation.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/relational/repository/query/RelationalEntityInformation.java b/src/main/java/org/springframework/data/relational/repository/query/RelationalEntityInformation.java index c331c0a..c03f202 100644 --- a/src/main/java/org/springframework/data/relational/repository/query/RelationalEntityInformation.java +++ b/src/main/java/org/springframework/data/relational/repository/query/RelationalEntityInformation.java @@ -18,7 +18,7 @@ package org.springframework.data.relational.repository.query; import org.springframework.data.repository.core.EntityInformation; /** - * JDBC specific {@link EntityInformation}. + * Relational database-specific {@link EntityInformation}. * * @author Mark Paluch */ diff --git a/src/main/java/org/springframework/data/relational/repository/support/MappingRelationalEntityInformation.java b/src/main/java/org/springframework/data/relational/repository/support/MappingRelationalEntityInformation.java index 6e77a52..3f75d91 100644 --- a/src/main/java/org/springframework/data/relational/repository/support/MappingRelationalEntityInformation.java +++ b/src/main/java/org/springframework/data/relational/repository/support/MappingRelationalEntityInformation.java @@ -20,11 +20,11 @@ import org.springframework.data.relational.repository.query.RelationalEntityInfo import org.springframework.data.repository.core.support.PersistentEntityInformation; import org.springframework.lang.Nullable; -import com.sun.corba.se.spi.ior.ObjectId; - /** * {@link RelationalEntityInformation} implementation using a {@link JdbcPersistentEntity} instance to lookup the * necessary information. Can be configured with a custom table name. + *

+ * Entity types that do not declare an explicit Id type fall back to {@link Long} as Id type. * * @author Mark Paluch */ @@ -82,11 +82,11 @@ public class MappingRelationalEntityInformation extends PersistentEntityI this.entityMetadata = entity; this.customTableName = customTableName; - this.fallbackIdType = idType != null ? idType : (Class) ObjectId.class; + this.fallbackIdType = idType != null ? idType : (Class) Long.class; } /* (non-Javadoc) - * @see org.springframework.data.jdbc.repository.query.JdbcEntityInformation#getTableName() + * @see org.springframework.data.relational.repository.query.RelationalEntityInformation#getTableName() */ public String getTableName() { return customTableName == null ? entityMetadata.getTableName() : customTableName;