英文:
Constructing a SQL save, update, remove query from hibernate entities?
问题
可以通过Hibernate创建原生SQL查询来保存、更新或从数据库中删除特定实体吗?
我正在寻找的内容基本上是这样的:
String sqlQuery = session.save(listOfEntities);
session.execute(sqlQuery);
sqlQuery: "insert into players(id,...) values((10,...),(11,...))"
英文:
Is it possible to create native SQL-queries for saving, updating or removing certain entities from the database via hibernate ?
What i am searching for is pretty much this...
String sqlQuery = session.save(listOfEntities);
session.execute(sqlQuery);
sqlQuery : "insert into players(id,...) values((10,...),(11,...))"
答案1
得分: 1
为什么你需要这些语句?只需执行 session.persist(entity)
,语句就会被自动执行。
英文:
Why would you need the statements? Just doing session.persist(entity)
will execute the statement for you already.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论