Skip to content

Commit 97363ce

Browse files
Regis Lerayolim7t
authored andcommitted
Fix quoting issue that caused Mapper.getTableMetadata() to return null.
1 parent d067119 commit 97363ce

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class Mapper<T> {
7575
this.mapper = mapper;
7676

7777
KeyspaceMetadata keyspace = session().getCluster().getMetadata().getKeyspace(mapper.getKeyspace());
78-
this.tableMetadata = keyspace == null ? null : keyspace.getTable(Metadata.quote(mapper.getTable()));
78+
this.tableMetadata = keyspace == null ? null : keyspace.getTable(mapper.getTable());
7979

8080
this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum();
8181
this.mapOneFunction = new Function<ResultSet, T>() {

driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,18 @@ public void should_map_objects_from_partial_queries() throws Exception {
419419
session.execute("delete from posts where user_id = " + u1.getUserId());
420420
}
421421

422+
423+
@Test(groups="short")
424+
public void should_return_table_metadata() throws Exception {
425+
MappingManager manager = new MappingManager(session);
426+
427+
Mapper<Post> m = manager.mapper(Post.class);
428+
429+
assertThat(m.getTableMetadata()).isNotNull();
430+
assertThat(m.getTableMetadata().getName()).isEqualTo("posts");
431+
assertThat(m.getTableMetadata().getPartitionKey()).hasSize(1);
432+
}
433+
422434
@Test(groups="short")
423435
public void should_not_initialize_session_when_protocol_version_provided() {
424436
Session newSession = cluster.newSession();

0 commit comments

Comments
 (0)