Hi everybody!
I have some question about a UserType.
I need these Type:
Code:
public class A {
private int id;
private int name;
}
and it uses:
Code:
public class B {
private int id;
private A a;
}
If I kept
A in a separate table
a with the fields: "ID, Name", I would do the following:
Code:
<hibernate-mapping>
<class name="B" table="b">
<id name="id">
<generator class="native"/>
</id>
<many-to-one name="a" column="a_id" class="A"/>
</class>
<hibernate-mapping>
But I want to do that without a table
a and with a static consts in
A, like this:
Code:
public final class A {
public static final A A_1 = new A(1,"str1");
public static final A A_2 = new A(2,"str2");
private int id;
private String name;
...
}
and when a hibernate loading some
B he uses well-defined staic const from
A
Thx a lot for help!
...and sorry for my english :(