Hi,
Say, for example, I have a State object. This State object has the following properties:
id - the unique id
shortName - the short name such as "WY"
longName - the long name such as "Wyoming".
Now say I have a Person object, which using a many to many association has a method getStatesVisited() that returns a Collection of State objects.
If I want to create a Person from an html form that gives me these State ids, wouldn't I have to load all the State objects from the database before I could create the Person?
Certainly, in this caseI could keep all the State objects in memory in a Singleton, for example, to make them easier to access but I was wondering if there were another hibernate pattern that made it easier to create/update objects when just given the Collection objects' ids rather than the objects themselves.
Thanks,
Gabe
|