Browse Source
The default ("") is equivalent to no annotation at all, i.e. the `NamingStrategy` determines the table name.
Original pull request: #109.
pull/128/head
3 changed files with 61 additions and 2 deletions
@ -0,0 +1,52 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2018-2019 the original author or authors. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.springframework.data.relational.core.mapping; |
||||||
|
|
||||||
|
import org.junit.Test; |
||||||
|
import org.springframework.data.annotation.Id; |
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat; |
||||||
|
|
||||||
|
/** |
||||||
|
* Unit tests for {@link RelationalPersistentEntityImpl} without names in {@link Column} and {@link Table}. |
||||||
|
* |
||||||
|
* @author Bastian Wilhelm |
||||||
|
*/ |
||||||
|
public class RelationalPersistentEntityWithoutNamesImplUnitTests { |
||||||
|
|
||||||
|
RelationalMappingContext mappingContext = new RelationalMappingContext(); |
||||||
|
|
||||||
|
@Test // DATAJDBC-296
|
||||||
|
public void discoversAnnotatedTableName() { |
||||||
|
|
||||||
|
RelationalPersistentEntity<?> entity = mappingContext.getPersistentEntity(DummySubEntity.class); |
||||||
|
|
||||||
|
assertThat(entity.getTableName()).isEqualTo("dummy_sub_entity"); |
||||||
|
} |
||||||
|
|
||||||
|
@Test // DATAJDBC-296
|
||||||
|
public void considerIdColumnName() { |
||||||
|
|
||||||
|
RelationalPersistentEntity<?> entity = mappingContext.getPersistentEntity(DummySubEntity.class); |
||||||
|
|
||||||
|
assertThat(entity.getIdColumn()).isEqualTo("id"); |
||||||
|
} |
||||||
|
|
||||||
|
@Table() |
||||||
|
static class DummySubEntity { |
||||||
|
@Id @Column() Long id; |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue