Skip to content

Update statement is no query?

How do I define the update statement in the orm.xml. I have it as a named-query and everything works, but my teacher said that an update statement isn’t a query. I have tried a native query, but that wasn’t working.


<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0"
    xmlns="" xmlns:xsi=""
    xsi:schemaLocation=" orm_1_0.xsd">

Update Statement:

<named-query name="updateTshirts">
        update Tshirt tshirt Set tshirt.bEdit = :bedit, tshirt.farbe = :farbe,
        tshirt.groesse = :groesse, tshirt.markenName = :markenname where
        tshirt.tID = :tid



The term “query” is used rather ambiguously. Some people interpret it literally as “asking for information”, meaning only select statements or other things producing a result set fall under this term, while others interpret it more broadly as any DML (Data Manipulation Language, i.e. select, insert, update, delete, merge, etc) statement.

Your teacher seems to fall in the first category, while the people who created the Jakarta Persistence API (JPA) fall into the second category. So, in a sense you’re both right, in the first interpretation, an update statement is not a “query”, but in the second interpretation, which is used by JPA, it is a “query”.

However, given the context, your interpretation is the better one.