forked from michaellavelle/spring-data-dynamodb
-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
first, sorry for bad english
Expected Behavior
userIdx, paymentType variable value is 1
Actual Behavior
userIdx, paymentType variable value is default value (0)
Steps to Reproduce the Problem
- connect local dynamodb
- create table
- save data
- paging and sort like findAllByMessageOrderByRegDateDesc
Specifications
- Spring Data DynamoDB Version: 4.5.7
- Spring Data Version: 1.5.15.RELEASE
- AWS SDK Version: 1.11.388
- Java Version: 8
- Platform Details: windows 10
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexRangeKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverted;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter;
import java.time.LocalDateTime;
@DynamoDBTable(tableName = "gz_feed")
public class Feed {
private String idx;
private int userIdx;
private String message;
private int paymentType;
private LocalDateTime regDate;
@DynamoDBHashKey
@DynamoDBAutoGeneratedKey
public String getIdx() {
return idx;
}
@DynamoDBAttribute
public int getUserIdx() {
return userIdx;
}
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "aaa")
public String getMessage() {
return message;
}
//@DynamoDBIndexRangeKey(attributeName = "PaymentType", globalSecondaryIndexName = "aaa")
@DynamoDBAttribute
public int getPaymentType() {
return paymentType;
}
@DynamoDBTypeConverted(converter = LocalDateTimeConverter.class)
@DynamoDBAttribute
@DynamoDBIndexRangeKey(globalSecondaryIndexName = "aaa")
public LocalDateTime getRegDate() {
return regDate;
}
public void setIdx(String idx) {
this.idx = idx;
}
public void setUserIdx(int userIdx) {
this.userIdx = userIdx;
}
public void setMessage(String message) {
this.message = message;
}
public void setPaymentType(int paymentType) {
this.paymentType = paymentType;
}
public void setRegDate(LocalDateTime regDate) {
this.regDate = regDate;
}
static public class LocalDateTimeConverter implements
DynamoDBTypeConverter<String, LocalDateTime> {
@Override
public String convert( final LocalDateTime time ) {
return time.toString();
}
@Override
public LocalDateTime unconvert( final String stringValue ) {
return LocalDateTime.parse(stringValue);
}
}
}
import org.socialsignin.spring.data.dynamodb.repository.DynamoDBPagingAndSortingRepository;
import org.socialsignin.spring.data.dynamodb.repository.EnableScan;
import org.socialsignin.spring.data.dynamodb.repository.EnableScanCount;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@EnableScan
@EnableScanCount
public interface FeedPagingRepository extends DynamoDBPagingAndSortingRepository<Feed, String> {
Page<Feed> findAllByMessageOrderByRegDateDesc(String message, Pageable pageable);
}