我需要使用HQL,两者都具有共同的列合并2个表,但table1共同的列是integer和table2普通列String
例如,
select a.id as id,a.name as name,b.address as address
from Personal as a,Home as b
where a.id=b.studid
Run Code Online (Sandbox Code Playgroud)
这里a.id是一个integer同时b.stduid是一个string,但两列的数据是一样的.
如何使用hql查询获取查询结果?
查询枚举列上的where子句会引发异常.
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
...
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: movedirection = bytea
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)
SQL:
create type movedirection as enum (
'FORWARD', 'LEFT'
);
CREATE TABLE move
(
id serial NOT NULL PRIMARY KEY,
directiontomove movedirection NOT NULL
);
Run Code Online (Sandbox Code Playgroud)
Hibernate映射类:
@Entity
@Table(name = "move")
public class Move {
public …Run Code Online (Sandbox Code Playgroud) 我有Hibernate Native Query的问题.我有一个选择数组切片的SELECT(PostgreSQL数据库).
问题是hibernate识别以下部分:"SELECT my_array [1:300] ..."中的":300"作为命名参数,我得到以下异常:并未设置所有命名参数.
我试图用':','::'来逃避冒号(:),但没有成功.
Hibernate版本是3.2