@Query("select o from Employee o where o.name like %?1%")
public List<Employee> getNameLike1(String name);
@Query("select o from Employee o where o.name like %:name%")
public List<Employee> getNameLike2(String name);
为啥我第二个方法没有绑定参数也没报错 还查出来了 就是?%和:那里有小红线
public List<Employee> getNameLike1(String name);
@Query("select o from Employee o where o.name like %:name%")
public List<Employee> getNameLike2(String name);
为啥我第二个方法没有绑定参数也没报错 还查出来了 就是?%和:那里有小红线
2018-03-19
在大型项目中不建议很多表嵌套查询,后期维护真的真的非常非常麻烦,反正我看sql还要一层层得看,现在hive啥的这么丰富,何必在项目中写一堆呢
2018-03-05
为什么我使用老师的匿名方式Query时,
@Query("select o from Employee o where o.name like %:name%")
public List<Employee> queryLike2(@Param("name") String name);
%:name%和Param绑定的name都报错呢?
提示java: 不兼容的类型: java.lang.String无法转换为java.lang.Class<?>
@Query("select o from Employee o where o.name like %:name%")
public List<Employee> queryLike2(@Param("name") String name);
%:name%和Param绑定的name都报错呢?
提示java: 不兼容的类型: java.lang.String无法转换为java.lang.Class<?>
2018-02-08
<key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
2018-01-15