tzman wrote:
In A I have a foreign key defined as not null; meaning it is a true one-to-many relationship.
In B I have a foreign key defined as nullable; meaning it is actually a zero-to-many relationship.
What would you expect to happen if in either case either the foreign key was null, or its value did not actually exist in the foreign table?
I understand that the first scenario is actually an error, but it can happen. I am just trying to get a good understanding of how things work and what to expect.
Hibernate will get lost. I can't remember the exact error message. Just try it, you should get an HibernateException.
tzman wrote:
Yes, unplugging the network will throw a LazyInitializationException, it looks aas though it wraps a JDBCException. What was the reasoning behind the collection API not declaring any checked exceptions? It would seem like the natural thing to do, but I am sure you all had good reasoning behind it.
Hehe, this is core java api (java.util.Collection). Ask sun to add an HibernateException ;-)