小编Mar*_*ria的帖子

JPA Hibernate - 更改持久对象的主键

我试图更改持久对象的ID.我正在使用JPA与Hibernate和MySQL.我执行代码时遇到的错误是:org.hibernate.HibernateException:com.tutorial.jpa.certification.listing5_18.AA实例的标识符从2更改为99

我找不到这个问题的答案,所以我很感激你的帮助.代码是:

    EntityManagerFactory emf=Persistence.createEntityManagerFactory("Tutorial");
    EntityManager em=emf.createEntityManager();     
    AA aa=em.find(AA.class, 2);

    em.getTransaction().begin();
    aa.setId(99);
    em.merge(aa);
    em.getTransaction().commit();
Run Code Online (Sandbox Code Playgroud)

hibernate jpa

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

文件处理 - Haskell

我如何在haskell中实现以下内容:

  1. 我从命令行收到一个输入文件.此输入文件包含用制表符,换行符和空格分隔的单词.
  2. 我必须用逗号替换这些元素(制表符,换行符和空格).
  3. 然后将结果写入一个名为的文件output.txt.

任何帮助深表感谢.我的哈克尔技能仍在发展中.


到目前为止,我有这个代码:

    processFile::String->String
    processFile [] =[]
    processFile input =input

    process :: String -> IO String
    process fileName = do
    text <- readFile fileName
    return (processFile text)

    main :: IO ()
    main = do
    n <- process "input.txt"
    print n
Run Code Online (Sandbox Code Playgroud)

在processFile函数中,我应该处理输入文件中的文本.

haskell file-processing winghci

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

标签 统计

file-processing ×1

haskell ×1

hibernate ×1

jpa ×1

winghci ×1