Hi,
I have a Class with a composite key, thatis made of a String and a koreign-key in db, but not in java code to simplify and when I do a simple query I obtain an error. Below I put the data. I would appreciatte any help.
Best Regards,
Rodolfo
Hibernate version:3.0
Mapping documents:
<class name="es.cyii.cpd.dataObject.Persona" table="PERSONAS">
<composite-id class="es.cyii.cpd.dataObject.PersonaClave" name="PersonaClave">
<key-property name="IdAcceso" column="IDACCESO"/>
<key-property name="NumDocumento" column="NUM_DOCUMENTO" type="string"/>
</composite-id>
....
</class>
<class name="es.cyii.cpd.dataObject.Acceso" table="ACCESOS">
<id name="IdAcceso" type="int">
<column name="IDACCESO"/>
<generator class="sequence">
<param name="sequence">SEQ_ACCESOS</param>
</generator>
</id>
...
</class>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
DEBUG org.hibernate.hql.ast.FromReferenceNode - Resolved : ta.PersonaClave.NumDocumento -> persona0_.NUM_DOCUMENTO
ERROR org.hibernate.hql.PARSER - *** ERROR: <AST>:0:0: unexpected AST node: :
DEBUG org.hibernate.hql.ast.ErrorCounter - <AST>:0:0: unexpected AST node: :
<AST>:0:0: unexpected AST node: :
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:826)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExprLhs(HqlSqlBaseWalker.java:3944)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:751)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:856)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:3261)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:2743)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1358)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1283)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:598)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:403)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:200)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:150)
.....
Name and version of the database you are using:Oracle 9.0.2
The generated SQL (show_sql=true):The exception is before the log is writed. but the query in HQL is
from Persona as ta where ta.PersonaClave.NumDocumento = :PersonaClave.NumDocumento
|