我尝试使用 CriteriaBuilder 而不是编写查询,但是当我测试它时,它给出错误并且无法提取 ResultSet。我在服务中的代码部分:
public List getCategories(String responsibleGroupId) throws Exception {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<SublogTypeMapV> query = builder.createQuery(SublogTypeMapV.class);
Root<SublogTypeMapV> root = query.from(SublogTypeMapV.class);
List<Predicate> andPredicates = new ArrayList<>();
Predicate categoryIdNotNull = builder.isNotNull(root.get(SublogTypeMapV_.categoryId));
Predicate categotyIdGt = builder.gt(root.get(SublogTypeMapV_.categoryId), 0);
String[] responsibleGroupListString = responsibleGroupId.split(",");
Long[] responsibleGroupListLong = new Long[responsibleGroupListString.length];
for (int i = 0; i < responsibleGroupListString.length; i++) {
responsibleGroupListLong[i] = Long.valueOf(responsibleGroupListString[i]);
}
Predicate responsibleGroup = root.get(SublogTypeMapV_.responsibleGroupId).in(responsibleGroupListLong);
Predicate getCategories;
if (responsibleGroupId != null && !responsibleGroupId.equals("0"))
getCategories = builder.and(categoryIdNotNull, categotyIdGt, responsibleGroup);
else
getCategories = …Run Code Online (Sandbox Code Playgroud) 我想在scilab中绘制Limacon,我需要处理以下方程式:

我知道,r>0和l>0
编译以下代码时,在第5行出现此错误:
行/列尺寸不一致。
如果设置t为特定数字,则最终会得到干净的曲线,其中没有任何功能。
我试图改变r和l到其它号码,但这并不做任何事情。有人知道我在做什么错吗?
r=1;
l=1;
t=linspace(0,2,10);
x = 2 * r * (cos(t))^2 + l * cos(t);
y = 2 * r * cos(t) * sin(t) + l * sin(t);
plot (x,y);
Run Code Online (Sandbox Code Playgroud)