| |

VerySource

 Forgot password?
 Register
Search
View: 691|Reply: 3

How do I execute the following statement in hibernate?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-21 12:00:01
| Show all posts |Read mode
String sql = "DELETE FROM item WHERE (i_id <> (SELECT MIN (i_id) AS i_id"
+ "FROM item t1 WHERE item.i_link = t1.i_link))";

How do I execute the following statement in hibernate3?
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-19 18:30:02
| Show all posts
Is it session.createSQLQuery (sql)
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-28 23:45:01
| Show all posts
Session session = (SessionFactoryImpl) factory) .openSession ();
PreparedStatement pstmt = ((SessionImpl) session) .getBatcher (). PrepareStatement (sql);
pstmt.execute ();
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-7-24 01:15:01
| Show all posts
I tried the method upstairs, the returned int is correct, but it was not deleted in fact, and the database is also locked
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list