Lewin, you're the best, I can't tell you how much I appreciate the help.
Before I get too far into what you've told me - let me show you the test project I've setup as a test-case. I took my example from the previous post and put it into a single, simple web project w/ a single servlet
Here's the doGet from my servlet (ORMUtility is HibernateUtil from Caveat Emptor, I just renamed it to protect the innocent):
Here is AttributeCategory and Attribute, respectively:
...and the corresponding hbm.xml files:
The queries that are spit out:
My full stack-trace w/ log4j output...
So, to simplify what happened here - I got the AttributeCategory record but did not get the Attribute records (Attributes List in AttributeCategory is null) *EVEN* though both of the queries being generated by Hibernate are correct! I bolded TestSession (the servlet) line 43 at the beginning of the post...it's the nested loop where I try to print the value of an Attribute from the collection...which is obviously null.
SOOOO...with all that being said...on to what you've stated in your last post.
I use the java.util.List for nearly all of the collections in my object model...would I have to swtich them all to org.hibernate.PersistentList!?
a) If you haven't implemented hashCode and equals in Attribute / AttributeCategory then do that right now . I've been re-reading some of the hibernate docs this week, and I remember mention of the fact that you have to do that if you want to use detached sessions (i.e. if you want to pass the object through many app layers ).
I'm not sure I follow this? Each class in my object model should have an unique hashCode value? I'm having a *very* serious problem passing the session through my app layer...session management has been a total nightmare for me so far. To break my app down I've got the following layers in my real app, which I'm trying to work through:
1. Presentation (Servlet, dispatching to a JSP
2. Facade (Small class library to sheild presentation from back-end)
3. "Framework" Layer (Object model, Hibernate)
4. Database (MS SQL 2000)
All three are cleanly separated. The presentation layer makes a call to the Facade to get objects. The facade calls the "Framework" layer, through encapsulation (open() and close() methods in facade).
Sessions have worked great this way until I tried to do the one-to-many join between these two objects. Otherwise, mapping one object to one table never caused a problem w/ sessions!
So, if setting a hashCode value to my object model classes will help w/ detaching form the session...that may be the magic cure for this issue!
I'm not using XMLEncoder, that I'm aware of?
[ September 23, 2005: Message edited by: Mark Spritzler ]