-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problems adding classes to config
PostPosted: Fri Dec 19, 2003 1:24 pm 
Newbie

Joined: Fri Dec 19, 2003 1:09 pm
Posts: 6
I searched the archives and couldn't find anything relevant about this, so I am asking it here. Actually, I have never seen this kind of behaviour in Java ever, so I am pretty baffled.

I have some code I stole from a tutorial to add the classes to the config. Here is part of it:
Code:
    private static void loadClasses() throws DAOException {
        Class[] classes = new Class[] {db.Category.class,                 db.Description.class,
      db.PerformanceTip.class,
      db.Tip.class};
        for (int i = 0; i<classes.length; i++) {
            try {
   System.out.println ("adding class " + classes[i].toString());
                cfg.addClass(classes[i]);
   System.out.println ("added class " + classes[i].toString());
            }
            catch (Exception me) {
   System.out.println ("load classes exception! " + me.getMessage());
                throw new DAOException(me);
            }
        }
    }


When it executes, it hits the "adding class" statement, then magically returns to the calling method. It never hits the "added class" line or throws an exception. The tomcat console has a "-Mapping resource: db/Category.hbm.xml" line, then "-Could not complete request" and that's it.

Beyond not knowing what is causing Hibernate to not add the class, I don't even understand how the code could process in that manner. Nutty. Any ideas? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 1:36 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
I think you are getting some Error which is not subclass of Exception so your catch doesn't catch it. Try catching Throwable to find out what is going on.


Top
 Profile  
 
 Post subject: that was it
PostPosted: Fri Dec 19, 2003 2:00 pm 
Newbie

Joined: Fri Dec 19, 2003 1:09 pm
Posts: 6
That was the answer. It never would have occurred to me to throw a Throwable instead of an Exception. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.