[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Existing column but column not found - urgent

Melladh do-not-reply at jboss.com
Thu Nov 30 12:01:30 EST 2006


This particular problem seems to have solved itself. Perhaps it was the fifth reboot that did it, I'm not sure.

After that, it complained about the keyfields being in the Many part of the relation mapping, so I moved it to the One part, in the jbosscmp-jdbc.xml

My current problem is that I simply cannot get the relationships to work automatically. I can't save them with
mainClass.setRelatedClass(Collection c);
where mainClass is One and relatedClass is Many.

Right now, I'm doing it like this, in pseudocode representation

sessionMethod(RelatedValues values)
  | {
  |     Collection c = mainClass.getRelatedClass();
  |     c.add(new RelatedClass(values));
  |     mainClass.setRelatedClass(c);
  | }

This gives me a nullpointerexception. The mainClass has just been created, so I can understand that I might get a nullpointerexception - after all, there is no collection of experience yet. But then how do I add it? If I simply try to use setRelatedClass with an entirely new collection, it doesn't accept it either. I get a more obscure nullpointerexception, that throws a long line of unhandled exceptions because it goes further down before it is thrown. The bean or container seems to not accept me creating a new collection to send in. An example I saw, from Sun, did it the way my pseudocode does, though in the mainClass bean instead of in the session.

The only examples I've been able to find so far doesn't have container managed relations, but programmatical (if that's the correct word in english); which I believe will not live up to the demands of this course.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990149#3990149

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990149



More information about the jboss-user mailing list