Hibernate version:
2.1.6
Hello all,
I've been trying to get a specific mapping to work for a day or two now. This is the first time I've see, or tried to do a mapping like this. I've searched all over, read the hibernate mapping examples, and docs. I'm not that new to hibernate, but at this point I think I'm just confused, and doing something fundamentally wrong.
I have a data table:
Code:
CREATE TABLE public.at_item
(
at_item_id serial NOT NULL,
at_item_name varchar(50),
at_item_simil_key varchar(3),
CONSTRAINT at_item_pk PRIMARY KEY (at_item_id)
) WITHOUT OIDS;
and domain object:
Code:
public class AtItem extends BaseObject {
private long id = -1;
private String name;
private Set similarItems;
.
.
}
I would like to have an AtItem object reference similar AItems via a Set mapping using at_item_simil_key as a key. Here's the XDoclet meta-tags:
Code:
* @hibernate.set name="similarItems" lazy="true"
* @hibernate.collection-key column="at_item_simil_key"
* @hibernate.collection-one-to-many class="com.domain.AtItem"
AtItems.getSimilarItems returns nothing. I do not get any errors. I activated "show_sql" and the query printed works if I manually run the query and plugin a value for "at_item_simil_key".
I hope this is clear.
So, can somebody tell me is this is just fundamentally wrong, or if a relationship like this is possible but I'm just going about it the wrong way.
Thanks,
Nick.