小编Xio*_*caL的帖子

如何使用 JPA 存储 Map<String, List<String>>

我正在尝试存储一个Map<String, List<String>>; 使用 JPA。

我的实体看起来像:

@Entity
@Table(name = "Profiles_table")
public class Profiles {

    @Id
    @Column(name = "profile_ID", updatable = false, nullable = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    private final HashMap<String, List<String>> AllProfiles;
    ...
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多地图设置,但它不起作用......

我尝试的最后一个:

@ElementCollection
@MapKeyColumn(name = "Profil")
@Column(name = "Permissions")
@CollectionTable(name = "Profiles_permissions", joinColumns = @JoinColumn(name = "profile_ID"))
Run Code Online (Sandbox Code Playgroud)

抛出以下异常:

org.hibernate.AnnotationException: Illegal attempt to map a non collection as a
@OneToMany, @ManyToMany or @CollectionOfElements: [...]Profiles.AllProfiles
Run Code Online (Sandbox Code Playgroud)

提前致谢

java dictionary hibernate jpa

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

AVRO 架构演变,记录类型的默认值

我正在尝试更新我们的 avro 架构以添加数据。

当我尝试使用新架构读取数据时遇到问题

使用新模式写入的数据没有问题。

当前架构:

{
    "type": "record",
    "name": "topLevelRecord",
    "fields": [
        {
            "name": "sub_record1",
            "type": [
                {
                    "type": "record",
                    "name": "sub_record1",
                    "fields": [...]
                }
            ]
        },
        {
            "name": "sub_record2",
            "type": [
                {
                    "type": "record",
                    "name": "sub_record2",
                    "fields": [...]
                }
            ]
        },
        {...}
    ]
}
Run Code Online (Sandbox Code Playgroud)

我的目标是添加sub_record3 具有以下架构的新子记录:

{
      "name": "sub_record3",
      "type": [
        {
          "type": "record",
          "name": "sub_record3",
          "fields": [
            {
              "name": "field1",
              "default": null,
              "type": [
                "null",
                "string"
              ]
            },
            {
              "name": "field2",
              "default": null,
              "type": …
Run Code Online (Sandbox Code Playgroud)

avro

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

打开 Outlook 的新电子邮件对话框,其中包含来自 Powershell 的预填充信息

我正在尝试编写一个 powershell 脚本(它将定期运行),用于打开 Outlook 的新电子邮件窗口,其中包含填充了一些数据的“to”、“subject”和“body”。

我找到了一种从 powershell 发送邮件的方法,但您必须从 powershell 发送它。这不符合需要,因为我必须编辑邮件正文。

$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "random.dude@email.com"
$Mail.Subject = "data for Subject"
$Mail.Body ="Example of body..."
$Mail.Send()
Run Code Online (Sandbox Code Playgroud)

基本上我需要的是$Mail.Show()打开一个新的电子邮件弹出窗口,其中包含预填充的数据

powershell不是必需的,它只是能够操纵前景的接缝,所以我尝试了它。

email powershell outlook

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

标签 统计

avro ×1

dictionary ×1

email ×1

hibernate ×1

java ×1

jpa ×1

outlook ×1

powershell ×1