简体   繁体   中英

Constructing a SQL save, update, remove query from hibernate entities?

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,...))"

Why would you need the statements? Just doing session.persist(entity) will execute the statement for you already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM