-->
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.  [ 2 posts ] 
Author Message
 Post subject: Configuration.addClass(clazz) - Hibernate 3.6
PostPosted: Thu Dec 23, 2010 3:08 pm 
Newbie

Joined: Fri Jun 27, 2008 2:50 pm
Posts: 4
Hello,
I migrated to Hibermate 3.6 and got a problem in Configuration.addClass(..) method call:
Code:
Configuration cfg = ....;
cfg.addClass(clazz);
//after migrating to hibernate 3.6 map = null
PersistentClass map = cfg.getClassMapping(MyBean.class.getCanonicalName() );
//now I get here NullPointerException
Table table = map.getTable();

The older Hibernate version returns map unequal to null, thus I can set the name of the table. The method Configuration.addClass(..) hasn't JavaDoc, thus I don't understand what can cause the problem. Before I start to analyze the source code of Configuration.addClass(..) I'd like to ask hibernate community, maybe someone can help :-)


Top
 Profile  
 
 Post subject: Re: Configuration.addClass(clazz) - Hibernate 3.6
PostPosted: Thu Dec 23, 2010 5:01 pm 
Newbie

Joined: Fri Jun 27, 2008 2:50 pm
Posts: 4
I found the problem:
in Hibernate 3.6 the Configuration.buildMappings(); method must be called to ensure the mappings are fully compiled/built.
Code:
Configuration cfg = ....;
cfg.addClass(clazz);
cfg.buildMappings();//must be called
PersistentClass map = cfg.getClassMapping(MyBean.class.getCanonicalName() );
Table table = map.getTable();


Andrej
:-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.