我需要一个WHERE子句来检查元组IN列表:(field1, field2) in (('1', 1), ('2', 2), ('3', 3))。这在Postgres中是有效的SQL。
方言: POSTGRES
jOOQ版本: 3.9.6
这种情况下正确的jOOQ语法是什么?
jOOQ 3.9文档暗示这是可能的,但是他们的示例仅给出了等级1:https ://www.jooq.org/doc/3.9/manual/sql-building/conditional-expressions/in-predicate-degree-n/
这段代码近似于我要查找的内容,但是我无法获取正确的类型/数据,referenceOrderIdLineNumbers也无法获取jOOQ生成的正确SQL。
Collection<Row2<String, Integer>> referenceOrderIdLineNumbers = ...
List<Object[]> rows = dsl.select(... , field("count(TABLE3)", Integer.class )
.from(Tables.TABLE1)
.join(Tables.TABLE2).on(Tables.TABLE2.PK1.eq(Tables.TABLE1.PK1))
.join(Tables.TABLE3).on(Tables.TABLE3.PK2.eq(Tables.TABLE2.PK2))
.where(
row(Tables.TABLE1.FIELD1, Tables.TABLE2.FIELD2) // <-- what to
.in(referenceOrderIdLineNumbers) // <-- do here??
)
.groupBy(...)
.fetch();
Run Code Online (Sandbox Code Playgroud) 我希望能够编写一个方面来检测我何时在我的一个org.mypackage类中投射某些东西。
package org.mypackage;
class Foo {
public static void main(String[] args) {
Bar casted = (Bar) args[0]; // want to detect this casting action!
}
}
Run Code Online (Sandbox Code Playgroud)
你如何编写一个切入点来表达强制转换操作,不仅仅是为了Foo类,而是对于org.mypackage.
背景:所以 Hibernate 5 + Spring Data JPA 需要通过继承来转换实体:
if (isInstanceOfMyEntity(someEntity)) {
// formerly, this was sufficient:
// MyEntity myEntity = (MyEntity) someEntity;
// now, this is required *everywhere* it is casted:
MyEntity myEntity = (MyEntity) Hibernate.unproxy(someEntity);
...
}
Run Code Online (Sandbox Code Playgroud)
...在大型代码库中,考虑这点很可怕,因为这可能会破坏很多地方。因此,如果可以编写一个切面/切入点来至少检测它,那么我们至少可以记录它并确定测试中需要解决问题的位置。
@Vlad-Mihalcea在这个问题如何将 Hibernate 代理转换为真实的实体对象中推荐了这种技术。
我有一个Google App Engine(1.8.5)项目.我想通过Webjars提供静态Javascript和CSS .但是,我一直在收到HTTP 404错误.如何使我的Webjars文件可访问?
我src/main/webapp/WEB-INF/appengine-web.xml根据Google的文档:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
...
<static-files>
<include path="/resources/**" />
<include path="/webjars/**" />
</static-files>
</appengine-web-app>
Run Code Online (Sandbox Code Playgroud)
我的src/main/webapp/index.html,引用了Webjars提供的Bootstrap CSS文件:
<html>
<head>
<link rel="stylesheet" href="webjars/bootstrap/3.0.0/css/bootstrap.min.css">
</head>
...
</html>
Run Code Online (Sandbox Code Playgroud)
片段pom.xml:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>(lots)</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0-beta</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我的第一个GAE帖子问题,所以我不确定提供什么额外信息 - 温和,所以.
我一直在使用一些提示我进行用户输入的 Yeoman 生成器。不过,我更愿意将我的输入放在 JSON 文件中。我可以看到它是yo-rc.json在之后生成的,但我想使用它(或类似的文件)作为 Yeoman 的输入。
使用JHipster 的示例:
$ yo jhipster
Welcome to the JHipster Generator v2.16.1
? (1/15) What is the base name of your application? (jhipster) helpme
? (2/15) What is your default Java package name? com.mycompany.helpme
...
# Yeoman Generator creates project via user inputs
Run Code Online (Sandbox Code Playgroud)
$ cat my-custom.json
{
"generator-jhipster": {
"baseName": "helpme",
"packageName": "com.mycompany.helpme",
...
$ yo jhipster --file my-custom.json
...
# Yeoman Generator creates project via input file …Run Code Online (Sandbox Code Playgroud) 我想生成HTTP响应主体,除了403 ForbiddenHTTP状态代码之外,还引用了一个错误消息,引用了诸如_"missing ...'CUSTOM_AUTHORITY'"_之类的内容.
我的应用程序是@PreAuthorize在Spring-MVC-REST中使用Spring-Security-Secured 方法的Spring Boot @Controller:
@Controller
@RequestMapping("/foo")
public FooController{
@PreAuthorize("hasAuthority('CUSTOM_AUTHORITY')")
public Object getSomething(){ ... }
}
Run Code Online (Sandbox Code Playgroud)
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(AccessDeniedException.class)
@ResponseStatus(HttpStatus.FORBIDDEN)
public Object forbidden(AccessDeniedException exception){ ... }
}
Run Code Online (Sandbox Code Playgroud)
我想要的是暴露/注入Collection<ConfigAttribute>.在Spring Security的文档中引用它.
我无法http | log按照入门流指南部署和执行基本流
:
wget https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/2.1.0.RELEASE/spring-cloud-dataflow-server/docker-compose.yml;
export DATAFLOW_VERSION=2.1.0.RELEASE;
export SKIPPER_VERSION=2.0.2.RELEASE;
docker-compose up;
open http://localhost:9393/dashboard/#/streams/create;
echo "Then, create a stream via text input: `http | log`"
echo "Then, deploy the stream. The deployment fails with exit code 137."
Run Code Online (Sandbox Code Playgroud)
我得到绿色的“成功部署的流定义”。状态显示为“正在部署”,但从未完全部署。ERROR日志、UI 或网络请求中没有消息。
这是docker-compose up我部署流后的控制台输出。
skipper | 2019-05-24 22:31:53.363 INFO 1 --- [io-7577-exec-10] o.s.s.support.LifecycleObjectSupport : started UPGRADE UPGRADE_DEPLOY_TARGET_APPS_SUCCEED UPGRADE_DEPLOY_TARGET_APPS UPGRADE_START UPGRADE_DELETE_SOURCE_APPS UPGRADE_CHECK_TARGET_APPS UPGRADE_WAIT_TARGET_APPS UPGRADE_CANCEL UPGRADE_DEPLOY_TARGET_APPS_FAILED UPGRADE_CHECK_CHOICE UPGRADE_EXIT INSTALL INSTALL_INSTALL INSTALL_EXIT ERROR DELETE DELETE_DELETE DELETE_EXIT ROLLBACK ROLLBACK_START …Run Code Online (Sandbox Code Playgroud) 如何仅通过指定包名称来生成QueryDsl Q-Class?鉴于源类位于我的target/generated-sources文件夹中,因为它们是其他构建插件(WSDL,XSD等)的产品.
我尝试使用以下插件,但找不到正确的配置:
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources</outputDirectory>
<processor>${com.mysema.query.apt.ProcessorClass}</processor>
</configuration>
</executions>
Run Code Online (Sandbox Code Playgroud)
和:
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0.4</version>
Run Code Online (Sandbox Code Playgroud)
我想做的是这样的事情:
<configuration>
<packageName>com.my.package</packageName>
<sourceFolder>target/generated-sources</sourceFolder>
<targetFolder>target/generated-sources/querydsl</targetFolder>
</configuration>
Run Code Online (Sandbox Code Playgroud)
...会生成类:
由于没有常见的JPA或JDO注释,并且我无法访问源文件,因此我无法将任何com.mysema.query.apt.*Processors用于maven-apt-plugin <processor>.
编辑1:添加了完整的maven-apt-plugin配置.
编辑2:
- 我能够通过maven命令行偶尔使用maven-apt-plugin工作,但不是通过扩展AbstractQuerydslProcessor来查找@XmlType注释类而不是Eclipse/STS.双代码生成无疑是不理想的解决方案.
我应该使用GET或POST检索敏感数据,因为:
在RFC 2616,对我来说,不为我澄清这一点:
当然,不可能确保服务器不会因执行
GET请求而产生副作用; 实际上,一些动态资源会考虑这个功能.这里的重要区别是用户没有请求副作用,因此不能对他们负责.[...]
我有很多想要重新命名的 Amazon ECS 服务。我喜欢他们的任务定义,所以我愿意接受克隆选项,我只是在UpdateService API中没有看到重命名服务的方法。有重命名的API吗?如果没有,我可以调用什么 API 组合(我认为python或awscli编写脚本将是最简单的选择)。
注意事项
我如何使用grpc_cli传递元数据?我的期望是我的服务器拦截器将能够使用X-FOO标头。
$ grpc_cli call --json_input --json_output localhost:7001 \
hello.HelloWorldService.SayHello "{'name': 'foo'}" \
-metadata "X-FOO:BAR;";
connecting to localhost:7001
Sending client initial metadata:
X-FOO : BAR;
E0726 13:26:20.231276000 4583892416 call.cc:900] validate_metadata: {"created":"@1564172780.231266000","description":"Illegal header key","file":"src/core/lib/surface/validate_metadata.cc","file_line":43,"offset":0,"raw_bytes":"58 2d 46 4f 4f 'X-FOO'"}
E0726 13:26:20.231808000 4583892416 call_op_set.h:942] assertion failed: GRPC_CALL_OK == g_core_codegen_interface->grpc_call_start_batch( call_.call(), ops, nops, core_cq_tag(), nullptr)
Run Code Online (Sandbox Code Playgroud)
该-helpfull文件说:
-metadata (Metadata to send to server, in the form of key1:val1:key2:val2)
type: string default: ""
Run Code Online (Sandbox Code Playgroud)
环境信息:
$ brew info grpc;
grpc: stable …Run Code Online (Sandbox Code Playgroud) shell command-line command-line-interface command-line-arguments grpc
java ×4
maven ×2
spring ×2
amazon-ecs ×1
aop ×1
command-line ×1
grpc ×1
hibernate ×1
http ×1
jhipster ×1
jooq ×1
postgresql ×1
querydsl ×1
rest ×1
security ×1
shell ×1
spring-aop ×1
spring-boot ×1
spring-mvc ×1
sql ×1
webjars ×1
yeoman ×1