Hello everyone,
i have a tiny problem that puzzles me all day long :
Java Object :
/**
* @return the localKey
* @hibernate.id generator-class="increment" column="localKey"
*/
public String getLocalKey(){
return localKey;
}
/**
* @return the id
* @hibernate.property column="id"
*/
public String getId() {
return id;
}
---
as you can see, the primaryKey of the Database Table is within the column localKey, BUT there is a 2nd column named ID, which is NOT the PK.
ok, the hbm.xml file snippet for this looks like this :
<id name="localKey"
column="localKey"
type="java.lang.String">
<generator class="increment"></generator>
</id>
<property name="id"
type="java.lang.String"
update="true"
insert="true"
column="id" />
-----------------
The Criteria Query to get some Data looks like this :
Criteria query= session.createCriteria(c);
query.add(Restrictions.like("id",id));
----------------
The generated SQL String looks like this :
select .... from myTable where this_.localKey like ?
-------------------------------------------------------------
Am I using some sort of reserved propertyname by using "id" ?
Somehow Hibernate translates my Restriction "id" into "localKey" and I cant figure out why :(
|