- 
                Notifications
    You must be signed in to change notification settings 
- Fork 310
Closed
Labels
type: bugA general bugA general bug
Milestone
Description
Got this on Version: 3.4.5
Steps For Reproduction:
Got Entity Class:
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Table("users_by_email")
public class CassandraUserByEmail extends CassandraEntity<Long> implements User {
    private String email;
    private String phoneNumber;
    private LocationDetails locationDetails;
    @Id
    public String getEmail() {
        return email;
    }
}
And repository interface to it:
public interface UserByEmailCassandraRepository extends BaseCassandraRepository<CassandraUserByEmail, Long> {
    Optional<User> findByEmail(String value);
}
Repository interface parent, supplied with additional interface, required for rest of the repositories
public interface BaseCassandraRepository<T extends Entity<ID>, ID extends Serializable> extends CassandraRepository<T, ID>, Repository<T, ID, CriteriaContainer> {
}
Expected Behaviour:
Mind that CassandraUserByEmail implements User interface. I expect that findByEmail method will return interface implementation, specified in generic.
Actual Behaviour:
Error with message
Failed to instantiate [com.gastonlagaf.springcassandra.entity.User]: Specified class is an interface
Investigations:
In CassandraAbstractQuery class there is a snippet (
Lines 105 to 111 in 9c009bc
| private Class<?> resolveResultType(ResultProcessor resultProcessor) { | |
| CassandraReturnedType returnedType = new CassandraReturnedType(resultProcessor.getReturnedType(), | |
| getOperations().getConverter().getCustomConversions()); | |
| return returnedType.isProjecting() ? returnedType.getDomainType() : returnedType.getReturnedType(); | |
| } | 
Maybe there should be considered a case when returned instance class is interface of domain type
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug