小编ete*_*arp的帖子

如何在Liquibase中执行第二次插入时引用自动递增的id?

我目前正在玩Liquibase并为用户创建了一个表,并为角色创建了一个表.每个用户都有一个唯一的id,当插入用户时,该ID是自动生成的(通过自动增量序列).然后,角色表中的角色将引用此ID.

现在我尝试使用Liquibase插入默认用户.首先我插入用户,然后我想插入一个引用这个新创建的用户的角色.

问题是我无法在Liquibase中找到一种方法来检索为新用户生成的id,以便在插入新角色时可以使用它.

这可能吗?如果是,应该怎么做?

想要做以下事情:

<insert tableName="xxx_user">
    <!-- Id is auto incremented -->
    <column name="user_name" value="XXX" />
    <column name="password" value="XXX" />
    <column name="first_name" value="XXX" />
    <column name="last_name" value="XXX" />
</insert>

<insert tableName="user_role">
    <column name="user_id" value="<point at the auto generated id in previous insert>" />
    <column name="role" value="A_ROLE" />
</insert>
Run Code Online (Sandbox Code Playgroud)

sql database postgresql liquibase

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

使用“amplify push”将我的新 lambda 函数推送到云时出现 venv 问题

我已经用 python 创建了一个 lambda,现在我尝试使用“amplify push”将其推送到云端。

最初我遇到了两个错误,但我通过安装 pipelinev 解决了一个错误。第二个错误是:

You must have virtualenv installed and available on your PATH as "venv". It can be installed by running "pip3 install venv".
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行该命令时,我得到:

ERROR: Could not find a version that satisfies the requirement venv (from versions: none)
ERROR: No matching distribution found for venv
Run Code Online (Sandbox Code Playgroud)

据我所知,我已经安装了 virtualenv,因为我可以运行“ py -m venv”

如何将它作为 venv 添加到我的路径中?我尝试通过在 Powershell 中创建一个函数来做到这一点,但在运行“amplify push”时它不起作用

python virtualenv python-3.x aws-amplify aws-amplify-cli

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

Spring Social 3.0.0.M1中的类org.springframework.social.connect.ConnectionRepository发生了什么?

我是Spring Framework的初学者,并希望尝试使用Spring Social来创建一个简单的Web应用程序,从Facebook检索数据.为此我遵循了Spring Socials官方的" 入门指南 ",名为" 访问Facebook数据 ".

我遇到的第一个问题是Spring Social版本2.0.3.RELEASE,它似乎是Spring Social的最新官方版本,不支持facebook API的2.8版本(因此给出了以下错误:" (# 12)对于版本v2.8及更高版本,不推荐使用bio field.正如我昨天在developers.facebook.com上创建了Facebook应用程序,似乎我无法访问以前的API版本.

我用谷歌搜索了一个解决方案,发现版本3.0.0.M1似乎在maven存储库中可用,这应该可以解决这个问题.但是,当我更改.pom文件中的配置以使用此版本时,编译器无法再找到类ConnectionRepository.实际上整个包org.springframework.social.connect似乎都缺失了.

我从指南(https://spring.io/guides/gs/accessing-facebook/)复制的代码如下所示:

import org.springframework.social.connect.ConnectionRepository;
import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.api.PagedList;
import org.springframework.social.facebook.api.Post;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class HelloController {

    private Facebook facebook;
    private ConnectionRepository connectionRepository;

    public HelloController(Facebook facebook, ConnectionRepository connectionRepository) {
        this.facebook = facebook;
        this.connectionRepository = connectionRepository;
    }

    @GetMapping
    public String helloFacebook(Model model) {
        if (connectionRepository.findPrimaryConnection(Facebook.class) == null) { …
Run Code Online (Sandbox Code Playgroud)

spring facebook-graph-api spring-social spring-social-facebook facebook-graph-api-v2.8

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