【问题标题】:IINSERT INTO in HQL在 HQL 中插入
【发布时间】:2020-09-03 13:07:01
【问题描述】:

如何在HQLHibernate中声明一个Insert Into?,和sql一样吗?

这是我的代码,我需要迁移到休眠:

DECLARE @variable int
SET @variable = (SELECT variable from entity WHERE description LIKE ('%Small%')) 

【问题讨论】:

  • 你做不到。有关可用设施的列表,请参阅documentation
  • 我找不到它@SternK,你能帮我看看文档吗?

标签: java hibernate jpa hql


【解决方案1】:

我解决了这个问题。我只是在控制器中声明一个对象并保存它。 示例:

//create an new object of the Entity and save using JPA
Example example = new Example() ;
example.setFuncion();
ExampleRepository.save(example);
//done

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-22
    • 1970-01-01
    • 2012-09-26
    • 2022-06-10
    • 1970-01-01
    相关资源
    最近更新 更多