一切正常,直到我需要按“ About.position”属性将“ About”实体排序。我在spring存储库界面中添加了一个方法,但此后不起作用。
关于实体
struct myFindInfo
{
DWORD processID;
bool found;
};
static BOOL CALLBACK findVisibleWindowProc(HWND hwnd, LPARAM lParam)
{
myFindInfo *fi = reinterpret_cast<myFindInfo*>(lParam);
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
if ((pid == fi->processID) && IsWindowVisible(hwnd))
{
fi->found = true;
return FALSE;
}
return TRUE;
}
bool isApplicationProcess(DWORD processID)
{
findInfo fi;
fi.processID = processID;
fi.found = false;
EnumWindows(&findVisibleWindowProc, reinterpret_cast<LPARAM>(&fi));
return fi.found;
}
回购接口
package coffee;
import javax.persistence.*;
import lombok.*;
import javax.validation.constraints.*;
@Data
@NoArgsConstructor(access=AccessLevel.PUBLIC, force=true)
@Entity
public class About {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@OrderBy
private Integer position;
@NotEmpty
private String name;
@NotEmpty
private String description;
@Lob
private String image;
}
错误源代码
package coffee.data;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import coffee.*;
public interface AboutRepository extends CrudRepository<About, Long> {
List<About> getAboutByPosition ();
}
当方法findAboutsByPosition()被忽略时,一切都很好
答案 0 :(得分:1)
getAboutByOrderByPosition() 错误的语法,解决了!