を解決できませんでした:org.hibernate.QueryException--は、私は以下のようなエンティティを持っている財産
@Entity
public class Country implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long id;
@Type(type="secureString") //This is my custom user type and it is working fine in the sense I am able to insert, select and update records using it.
private SecureString nationality;
// getters and setters
}
SecureStringクラスは以下の通りです:
public class SecureString implements Serializable {
private static final long serialVersionUID = 1L;
private String actualValue;
private String formattedValue;
//getters and setters
}
The column name in db for this attibute is named "nationality"
だけあります1つの列は国籍に対応します。私はこのためにHibernate Custom UserType
を使用しています。以前は、このプロパティはSecureString
ではなくString
でした。
私は例外を取得しています形成java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: actualValue of: mypackge.Country.
HQLは次のとおりです。
select s FROM mypackage.Country s
WHERE LOWER(s.nationality.actualValue) LIKE LOWER(:nationality_actualValue);
ログを1として、私たちはHibernateは変換中Country
クラス内の名前actualValue
を持つプロパティを検索しようとしていることがわかりますHQ1~SQ1。この問題をどうやって解決するのですか?
注:同じEntityクラスでSecureString型の複数の属性を使用できます。
ログ:
at org.hibernate.QueryException.generateQueryException(QueryException.java:120) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:217) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:141) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:77) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:545) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:654) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
... 142 common frames omitted
Caused by: org.hibernate.QueryException: could not resolve property: actualValue of: mypackage.Country
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:62) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:56) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1859) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:393) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:512) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:660) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.tree.DotNode.prepareLhs(DotNode.java:264) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.tree.DotNode.resolveInFunctionCall(DotNode.java:178) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:1030) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1286) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4699) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2729) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1361) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4699) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4313) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2134) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2087) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2084) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2084) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2084) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2084) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2062) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:813) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:607) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:311) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:259) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:261) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:189) ~[hibernate-core-5.2.8.Final.jar:5.2.8.Final]
... 148 common frames omitted
あなたはログを投稿してもらえますか? – Aldeguer
あなたの 'SecureString'はマップされていません! –
@兵器宮本ポイントを取得していません。カスタムUserTypeを作成し、このフィールドに注釈を付けました。他にどのようなマッピングがありますか? SecureStringはエンティティではありません。 – Aman