小编Qcu*_*ber的帖子

如何对同一实体内的@ElementCollection 执行子查询?

考虑以下实体。

@Entity
public class Member {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String memberName;

    @ElementCollection
    @CollectionTable(joinColumns=@JoinColumn(name="memberId"))
    @MapKeyColumn(name="prop")
    @Column(name="val")
    private Map<String, Boolean> checklist;

    /** usual getters and setters **/
}
Run Code Online (Sandbox Code Playgroud)

假设上述实体创建了两个表;成员和member_checklist;我是否可以使用 jpa 2 标准 api 实现以下 sql 语句?

select * from member where id not in (
    select memberid from member_checklist where prop in (2));
Run Code Online (Sandbox Code Playgroud)

我已经阅读了Hibernate Criteria API - 添加了一个标准:字符串应该在集合中,但我仍然不知道如何实现我的目标。

期待一些专家的意见。

hibernate criteria eclipselink criteria-api jpa-2.0

5
推荐指数
0
解决办法
1866
查看次数

使用Angular 4为Jhipster添加新路由

我正在尝试将新菜单项添加到默认生成的JHipster应用程序中.我顺便使用Angular 4.

我面临的问题是我总是得到以下错误.

错误:未捕获(在承诺中):错误:无法匹配任何路由.网址细分:'用户资料'

以下是我添加的代码.

首先,我在src/main/webapp/app下添加了一个名为user-profile的文件夹.

在其中,我添加了index.ts,user-profile.component.html,user-profile.component.ts和user-profile.route.ts

index.ts的内容

export * from './user-profile.component';
export * from './user-profile.route';
Run Code Online (Sandbox Code Playgroud)

user-profile.component.ts的内容

import { Component, OnInit } from '@angular/core';
import { Principal } from '../shared';

@Component({
    selector: 'jhi-user-profile',
    templateUrl: './user-profile.component.html'
})
export class UserProfileComponent implements OnInit {
    account: Account;

    constructor(private principal: Principal) {}

    ngOnInit() {
        this.principal.identity().then((account) => {
            this.account = account;
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

user-profile.route.ts的内容

import { Route } from '@angular/router';

import { UserRouteAccessService } from '../shared';
import { UserProfileComponent } from './';

export const …
Run Code Online (Sandbox Code Playgroud)

jhipster angular angular-router

2
推荐指数
1
解决办法
3423
查看次数

如何使用h:inputText + managed bean在JSF中保存列表/ map/set

我想要实现的内容与以下链接中发布的内容非常相似.

如何使用ui重复+ h:inputText +托管bean在JSF中保存数组?

我对Arjan Tijms在上面的链接中提供的答案特别着迷,但我想要达到的目标略有不同.请考虑以下代码段.

豆子

import javax.annotation.PostConstruct;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;

@RequestScoped
@Named
public class MyBean {

    List<String> choices;

    public List<String> getChoices() {
        return choices;
    }

    @PostConstruct
    public void initChoices() {
        choices= new ArrayList<String>();
    }

    public String save() {
        // should save all the choices into some repository
        return "";
    }
}
Run Code Online (Sandbox Code Playgroud)

和facelet页面

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"        
    xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:body>

        <h:form>
            <ui:repeat value="#{myBean.choices}" varStatus="status">            
                <h:inputText value="#{myBean.choices[status.index]}" />
            </ui:repeat>
            <h:commandButton value="Save" action="#{myBean.save}" />
        </h:form>
    </h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

问题是,如果我们在开头的列表中有一些初始数据,这将有效.初始列表为空的情况怎么样?

我正在寻找的理想解决方案是每个选项都有1小时:inputText,当点击保存按钮时,每个h:inputText中的所有选项都会被添加到选项列表中.我搜索过高低,但似乎无法找到关于如何做到这一点的任何提示.

如果JSF 2真的不支持这个,我想我只需要用一个h:inputText来使用丑陋的方式并使用转换器来转换成列表,但我仍然希望理想的解决方案可以是找到.

希望来自stackoverflow的人可以为我指明正确的方向.

jsf-2

1
推荐指数
1
解决办法
9879
查看次数

JHipster OAuth2 + Keycloak用户相关用例

从各种谷歌上搜索和阅读https://www.jhipster.tech/security/#oauth2,我收集的是,为了与JHipster移动/社会融合产生的应用程序,我应该使用的OAuth2.我是这样思考的吗?(我似乎无法找到明确的答案)

我使用启用了OAuth2的JHipster v5.1.0创建了一个新的应用程序.我注意到在用户管理方面缺少一些功能.以下是我的问题.

  1. 新用户如何注册新帐户?
  2. 用户如何更改密码/重置忘记密码?

希望有上述经验的人可以帮助澄清.

先感谢您.

oauth-2.0 jhipster keycloak okta

0
推荐指数
1
解决办法
394
查看次数