2012-02-17 10 views
0

非常にシンプルな春のリポジトリ:JPAクエリパラメータはHibernateで出荷されますか?

2012-02-17 23:00:18,105 DEBUG: select organizati0_.name as col_0_0_ from Organization organizati0_ where organizati0_.name like ? >>> org.hibernate.engine.jdbc.spi.SqlStatementLogger.logStatement(SqlStatementLogger.java:104) 

休止状態を:私はようなSQLのみ取得

@RequestMapping(value="/names", method=RequestMethod.GET) 
public @ResponseBody List<String> getCompanyNameList(@RequestParam String term) { 
    List<String> companyNames=organizationRepository.findCompanyName(term); 

    return companyNames; 
} 

が、コンソールに:

public interface OrganizationRepository extends CrudRepository<Organization, Long> { 


@Query("select o.name from Organization o where o.name like ?1 ") 
List<String> findCompanyName(String term); 

}

と呼び出されたとしても、単純な:organizati0_.nameをcol_0_0_から選択してください組織organizati0 _組織名はどこですか?

どこが間違っていますか?

私は春-MVC 3.1.0、春データ-JPA 1.1.0を使用しています、休止状態-entitymanger 4.0.1最終

答えて

0

?間違っています。それは 'o.name like:name'のようなものでなければなりません。

1

質問はOKです。

クエリに渡された実際のパラメータ値を参照したい場合は、log4j.properties

log4j.logger.org.hibernate.type=trace 
に次のエントリを追加します。
関連する問題