0

could we realize an insert query with hibernate. I read that must be a jdbc connection to the database if we want to insert into a table. think you.

1
  • 3
    nhibernate is .NET; Hibernate and JDBC are Java. Please clarify which one you mean. You must create a connection to a database, regardless of platform. Commented Apr 28, 2010 at 14:09

1 Answer 1

2

To do a raw SQL insert, you'll need indeed to use the underlying JDBC connection of the Session that you can get with session.connection():

Connection conn = session.connection();
// create a java jdbc statement
Statement statement = conn.createStatement();
statement.executeUpdate("INSERT INTO ...");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.