我有一个JPA实体层次结构,JPA加入了继承:
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
Product
Run Code Online (Sandbox Code Playgroud)
和
@Entity
@Table(name = "product_quiz")
@DiscriminatorValue("quiz")
public class QuizProduct extends Product
Run Code Online (Sandbox Code Playgroud)
我想用QueryByExample运行一个spring-data查询,PageRequest如下所示:
Example<Product> example = ...
PageRequest pageRequest = ...
Page<Product> productPage = productRepository.findAll(example, pageRequest);
Run Code Online (Sandbox Code Playgroud)
它工作正常,除非我设置sortField为pageRequest"类型"(the @DiscriminatorColumn).
我试过:
org.postgresql.util.PSQLException: The column index is out of range: 11, number of columns: 10.@Transient,持续存在的作品,但查询给了我这样的例外:Unable to locate Attribute with the the given name [type] on this ManagedType [...AbstractEntityWithDate](AbstractEntityWithDate是@MappedSuperclass …