I've made a application just like the example in the "2.3.3. Working the association" of "hibernate_reference.pdf"
[code]org.hibernate.Session session1 = HibernateUtil.currentSession();
org.hibernate.Transaction tx = session1.beginTransaction();
TabHibtest aTest = (TabHibtest)session1.load(TabHibtest.class,new Integer(1));
TabHibchild aChild = (TabHibchild)session1.load(TabHibchild.class,new Integer(1));
aTest.getChilds().add(aChild);
tx.commit();
HibernateUtil.closeSession();[/code]
"TabHibtest " and "TabHibchild" just like "Person" and "Event" in the example. And my "id"'s type is Integer. I write them in a jsp. When I run it. It says "org.hibernate.exception.GenericJDBCException: could not initialize a collection: [test.TabHibtest.childs#1]
..."
I want to know why?
Thanks.
|