-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Composite-Key with a Foreing Key
PostPosted: Fri Apr 29, 2005 3:23 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.