You have two options. The first is to write your query as an SQL query instead of an HQL query.
Code:
Query q = session.createSQLQuery("select patindex('%yourstring%', YourColumn) from YourTable");
The second is to download the source code for Hibernate, edit the appropriate Dialect file (as pointed to by the hibernate.dialect property in your hibernate.cfg.xml file), add the registerFunction line I posted earlier, and rebuild the hibernate jar. For example, if your hibernate.cfg.xml file includes this line:
Code:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
Then you'll edit org/hibernate/dialect/MySQLDialect.java.