我有一个客户,它与customerBudget实体有关联.CustomerEntityListener将创建customerBudget实体.
我收到以下错误:
IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: de.company.entity.Customer-c4775b5b-413b-0567-3612-e0860bca9300 [new,managed].
Run Code Online (Sandbox Code Playgroud)
onAfterInsert(Customer实体)中的代码
LoadContext<Customer> loadContext = LoadContext.create(Customer.class);
loadContext.setId(entity.getId());
Customer customer = dataManager.load(loadContext);
CustomerBudget customerBudget = new CustomerBudget();
customerBudget.setCustomer(customer);
CommitContext commitContext = new CommitContext(customerBudget);
dataManager.commit(commitContext);
Run Code Online (Sandbox Code Playgroud)
如何在EntityListener中创建和持久化Entites?
我想知道将 CUBA studio 主题复制到我的应用程序中有多容易?例如,默认情况下它使用 halo 主题,但想知道是否还有其他主题。
我有4个实体:
人(姓名,电子邮件等)
我需要3个屏幕,除了Counterpart之外每个屏幕一个,我在几个设计可能性中犹豫不决.目标是避免给定屏幕中存在父实体已存在屏幕的重复字段.例如,如果我为Person设计了一个屏幕,我想以某种方式在子屏幕实体的屏幕中重复使用此屏幕(而不是复制字段,例如'name').
我带来了以下选项:
对platfom screen/xml继承非常感兴趣,这似乎很适合我的问题,但它确实只适用于平台屏幕,而不是用户设计的,不幸的是.
设计一个(智能)屏幕,您可以在某种程度上选择实体类型,然后屏幕会动态添加GUI组件来处理实体的细节.屏幕将更加复杂,并且主要通过代码进行管理,而不是视觉设计,这让我很烦恼(为什么还有视觉设计师).除非有设计提示.
设计3个不同的屏幕,但有一种方法可以重复使用以前在视觉上设计的字段组.我知道我可以在代码中完全生成GUI组件.
为实体细节设计3个编辑器屏幕,并有一些方法来组合/嵌入它们,但在这种情况下,我可能不得不将实体模型从继承更改为组合,以使其更容易.
现在我倾向于选项2),当他们处理的细节不再相关时,使用例如框架折叠自己,但我担心它不会起作用,因为编辑器绑定到特定的类.
经验丰富的CUBA开发人员会建议什么?
我想在欢迎/主页选项卡上显示一些统计信息和链接.如何固定标签或防止关闭?
这是一个很好的解决方案,还是应该使用主窗口作为"仪表板"?
我想打开一个链接并进行方法调用.
机会:我想调用一个控制器方法并链接一个网址.invoke方法创建历史记录条目.
机会:否则我可以使用linkbutton whitch调用方法.在这种情况下,如何从控制器方法打开链接?
我有一本书数据源.一本书有很多作者.该集合显示在book-edit-view的网格中.现在我想按作者姓名排序.在collectionDatasource属性中,我将sortable设置为true.我该怎么做?
有人可以帮助我,为什么我会收到这个错误.
SQLSyntaxErrorException:user缺少未找到的权限或对象:REPORT_GROUP
public enum EnumCountry implements EnumClass<Integer> {
Ethiopia(1),
Tanzania(2),
private Integer id;
EnumCountry(Integer value) {
this.id = value;
}
public Integer getId() {
return id;
}
@Nullable
public static EnumCountry fromId(Integer id) {
for (EnumCountry at : EnumCountry.values()) {
if (at.getId().equals(id)) {
return at;
}
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
我有上面的代码.如何使用其枚举名称获取Enum Id.
我在 cuba 平台上创建了一个自定义的 rest 控制器,并按照文档https://doc.cuba-platform.com/restapi-7.1/#rest_api_v2_custom_auth 中的说明进行操作
我的“rest-dispatcher-spring.xml”
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<context:component-scan base-package="com.company.test.web.resource"/>
</beans>
Run Code Online (Sandbox Code Playgroud)
将“rest-dispatcher-spring.xml”添加到“web-app.properties”
cuba.restSpringContextConfig = +com/company/test/rest-dispatcher-spring.xml
Run Code Online (Sandbox Code Playgroud)
我的控制器看起来像这样
package com.company.test.web.resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@RestController
@RequestMapping("/test")
public class TestResource {
@RequestMapping(value = "/testAPI", method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity testAPI() {
return new ResponseEntity<>(HttpStatus.OK);
}
}
Run Code Online (Sandbox Code Playgroud)
我可以从 Postman 调用 API,但该 API 未使用 URL 在 Swagger-ui 中显示 …
cuba-platform ×11
cuba ×2
java ×2
jpql ×2
css ×1
enums ×1
jpa ×1
spring ×1
swagger-2.0 ×1
swagger-ui ×1
vaadin ×1