This is a very basic newbie question, and I'm sure the answer may be found somewhere in the piles of excellent documentation. I am happy to read; I just need a pointer. Thanks in advance for anyone's time who is still with me on this. :-)
As I said, a very simple problem. I have a domain object that can take in a String. I'd like, however, on the database side to enforce that the supplied String be present in a lookup/type table. This usually means that the thing I would store on the main table would be an integer pointing at an entry in a lookup table, whose primary key would be the integer and whose value would be the String.
So, for example, instead of storing "state" as a String on my Address table, I might store 2, which would point at the tuple in the State table of {2, Massachusetts}.
Now, these are database semantics. My class' callers are simply going to expect a setState(String) method that may puke if it gets a bad state.
What is the preferred Hibernate mechanism for mapping an arbitrary string property as a pointer-into-a-type-table property instead?
Thanks again; I'll continue reading.
Best,
Laird
|