@@ -0,0 +1,1531 @@
+package com.vladmihalcea.book.hpjp.hibernate.query;%0A%0Aimport java.util.List;%0Aimport javax.persistence.Column;%0Aimport javax.persistence.Entity;%0Aimport javax.persistence.Id;%0Aimport javax.persistence.Table;%0A%0Aimport org.hibernate.Session;%0A%0Aimport org.junit.Test;%0A%0Aimport com.vladmihalcea.book.hpjp.util.AbstractTest;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author Vlad Mihalcea%0A */%0Apublic class EscapeKeywordTest extends AbstractTest %7B%0A%0A    @Override%0A    protected Class%3C?%3E%5B%5D entities() %7B%0A        return new Class%3C?%3E%5B%5D %7B%0A            Table.class,%0A        %7D;%0A    %7D%0A%0A    @Test%0A    public void test() %7B%0A        doInJPA(entityManager -%3E %7B%0A            Table table = new Table();%0A            table.id = 1L;%0A            table.from = %22from%22;%0A            table.number = 123;%0A            table.select = %22*%22;%0A%0A            entityManager.persist(table);%0A        %7D);%0A%0A        doInJPA(entityManager -%3E %7B%0A            List%3CTable%3E tables = entityManager.createQuery(%0A                %22select t %22 +%0A                %22from Table t %22 +%0A                %22where t.from like 'from'%22, Table.class)%0A            .getResultList();%0A            assertEquals(1, tables.size());%0A        %7D);%0A    %7D%0A%0A    @Entity(name = %22Table%22)%0A    @javax.persistence.Table(name = %22%5C%22table%5C%22%22)%0A    public static class Table %7B%0A%0A        @Id%0A        private Long id;%0A%0A        @Column(name = %22%5C%22number%5C%22%22)%0A        private Integer number;%0A%0A        @Column(name = %22%5C%22from%5C%22%22)%0A        private String from;%0A%0A        @Column(name = %22%5C%22select%5C%22%22)%0A        private String select;%0A    %7D%0A%7D%0A

Add new test