From time to time it is necessary to execute a query without using Java’s JPA infrastructure.
In order to do it, we have to define a NamedQuery to execute. In this example, I will run an update against the database.
@Entity @NamedQueries ({ @NamedQuery ( name = "SomeEntity.TestQuery", query = "update SomeEntity se set se.myField = '' where se.id = 0" ) }) public class SomeEntity implements Serializable { // .