我正在使用休眠和 REST 服务。查看下面的代码REST SERVICE,在这种情况下如何使用 HQL 语句(Hibernate 查询)提取 content_id ?
例如我的尝试...
<query cache-mode="get" cacheable="true" flush-mode="auto"
name="Languages.getLanguageById" read-only="true">
select languageId as id,displayName as name from Languages where id=<query-param name="languageId" type="java.lang.Long"/>
</query>
//休息服务
@Path("{resource}/getLanguageById")
@GET
@Produces(MediaType.TEXT_XML)
public String getLanguageById(@PathParam("resource") String id,
@QueryParam("content-id")String content_id)
{
........
.......
}
//休眠XML
<hibernate-mapping>
<class catalog="CONTENT" name="test.db.com.Languages" table="languages">
<id name="languageId" type="java.lang.Long">
<column name="languageId"/>
<generator class="identity"/>
</id>
<property generated="never" lazy="false" name="language" type="string">
<column length="50" name="language" not-null="true"/>
</property>
<property generated="never" lazy="false" name="displayName" type="string">
<column length="50" name="displayName" not-null="true"/>
</property>
</class>
</hibernate-mapping>