How to use MySQL's full text search from JPA

前端 未结 7 1899
谎友^
谎友^ 2020-12-15 13:55

I want to use MySQL\'s full text search features using JPA, without having to use a native query.

I am using EclipseLink, which has a function to support native SQL

7条回答
  •  鱼传尺愫
    2020-12-15 14:22

    FInally work

    if you set your table colums wit index full search

    @NamedNativeQuery(name = "searchclient", query = "SELECT * FROM client WHERE MATCH(clientFullName, lastname, secondname, firstphone," + " secondphone, workphone, otherphone, otherphone1," + " otherphone2, detailsFromClient, email, company," + " address, contractType, paymantCondition) AGAINST(?)",

    List list = em.createNamedQuery("searchclient").setParameter(1, searchKey).getResultList();

提交回复
热议问题