Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hello everyone,
I am trying to map a class to a database.
Class DeviceID {
String id;
String domain;
}
mapping file:
<class name="DeviceID" table="device_id">
<id name="pk_id" type="long" column="pk_id" access="field">
<generator class="native" />
</id>
<property name="id" type="string" column="device_id" access="field" length="50"/>
<property name="domain" type="string" column="domain" length="50" access="field"/>
</class>
I can insert DeviceIDs into device_id table. while when trying to get DeviceID from table. using
select d from com.gehc.device.model.DeviceID d
where d.id = :id and d.domain = :domain
Hibernate always maps DeviceID.id to pk_id column:
select
deviceid0_.pk_id as pk1_0_,
deviceid0_.dev_id as dev2_0_,
deviceid0_.domain as domain0_
from
device_id deviceid0_
where
deviceid0_.pk_id=?
and deviceid0_.domain=?
INFO - could not bind value 'id1' to parameter: 1
Is there any way to solve this problem?
Thanks you very much.
young