From 72081ff7ba8f380d42944a2dd39c5b8b811b16b0 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Thu, 30 Dec 2010 22:13:57 +0100 Subject: [PATCH] Note that Native SQL Query is not to be used for DELETE, UPDATE and INSERT statements. --- en/reference/native-sql.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/en/reference/native-sql.rst b/en/reference/native-sql.rst index 77bd0ad78..3d976794a 100644 --- a/en/reference/native-sql.rst +++ b/en/reference/native-sql.rst @@ -1,7 +1,7 @@ Native SQL ========== -A ``NativeQuery`` lets you execute native SQL, mapping the results +A ``NativeQuery`` lets you execute native SELECT SQL statements, mapping the results according to your specifications. Such a specification that describes how an SQL result set is mapped to a Doctrine result is represented by a ``ResultSetMapping``. It describes how each column @@ -9,6 +9,14 @@ of the database result should be mapped by Doctrine in terms of the object graph. This allows you to map arbitrary SQL code to objects, such as highly vendor-optimized SQL or stored-procedures. +.. note:: + + If you want to execute DELETE, UPDATE or INSERT statements + the Native SQL API cannot be used and will probably throw errors. + Use ``EntityManager#getConnection()`` to access the native database + connection and call the ``executeUpdate()`` method for these + queries. + The NativeQuery class ---------------------