title: PostgreSQL parameterized query in Spring repository
body: <p>I am using Spring framework and PostgreSQL database .In the following query I want to select those rows which have product name matched by the parameter `keyword' When I run the following query it gives me the following error</p>
  
  <p>Does anybody tell me how to write right query ?</p>
  
  <p><strong>Query:</strong> </p>
  
  <pre><code>@Query(value="Select pp from product_photo pp join products p ON pp.product_id=p.id Where p.name ~* ?Keyword",nativeQuery = true)
      List&lt;ProductPhoto&gt; trail(@Param("keyword")String Keyword);
  </code></pre>
  
  <p><strong>API:</strong></p>
  
  <p><a href="http://localhost:8080/productPhotos/search/trail?keyword=Bottles" rel="nofollow noreferrer">http://localhost:8080/productPhotos/search/trail?keyword=Bottles</a></p>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
  </code></pre>
  
  <p><strong>Product Entity</strong></p>
  
  <pre><code>@Entity
  @Table(name="products")
  public class Product implements Serializable{
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @SequenceGenerator(name="SEQ_PRODUCTS", sequenceName="PRODUCTS_SEQ", allocationSize=1)
      @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_PRODUCTS")
      private Long id;
  
      @NotEmpty
      @Column(name="NAME", nullable=false)
      private String name;
  
      @Column(name="DESCRIPTION",length=1000)
      private String description;
  
      @Column(name="PRICE", nullable=false)
      private Double price;
  
      private String SKU;
  
      private String supplierCode;
  
      private String readerOfferCode;
  
      private float productWeight;
  
      private Boolean statusEnabled=true;
  
      private float quantity;
  
      public String barcode;
  
      private boolean featuredProduct;
  
      private Double meanRating;
  
      private Double discountedPrice;
  
      @Enumerated(EnumType.STRING)
      private stockStatus stockStatus;
  
      @ManyToOne 
      private Supplier supplier;
  
      @ManyToOne (fetch = FetchType.EAGER)
      private ProductCategory productCategory;
  
      @ManyToOne
      private ProductDepartment productDepartment;
  
      @JsonIgnore
      @OneToMany(mappedBy="product",targetEntity=ProductPhoto.class,fetch = FetchType.EAGER)
      private List&lt;ProductPhoto&gt; pictures;
      ..// Getters and setters 
      }
  </code></pre>
  
  <p><strong>ProductPhoto Entity</strong></p>
  
  <pre><code>@Entity
  public class ProductPhoto implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
          @Id
          @GeneratedValue(strategy=GenerationType.IDENTITY)
          private Long id;
  
          //@JsonIgnore
          @ManyToOne 
          private Product product;
  
          private String path;
  
          private Boolean primaryPhoto=false;
  
          @Column( nullable = false, updatable = false, insertable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
          @Temporal(TemporalType.TIMESTAMP)
          private Date uploadDate ;
          //..getters and setters }
  </code></pre>