-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem about Configuration.addClass()?
PostPosted: Thu Mar 28, 2013 2:31 am 
Newbie

Joined: Thu Mar 28, 2013 2:18 am
Posts: 1
Hello, everyone:
I meet a problem, I have an entity called User, which annotated by java persistence api,
<bean id="_sessionFactory" class="org.springdmhibernate.bean.MySessionFactoryBean">
<property name="dataSource" ref="_dataSource"/>
<property name="annotatedClasses">
<list>
<value>org.test.model.User</value>
</list>
</property>
</bean>
MySessionFactoryBean is :
public class MySessionFactoryBean extends AnnotationSessionFactoryBean
it can run successfully, and the db generated the table t_user, it's normal.
But now, I don't want to config the annotatedClasses to map entities, I want to do it in code, so I do bellow:

I override the method in MySessionFactoryBean:
@Override
protected void postProcessMappings(Configuration config)
throws HibernateException {
config.addClass(User.class); // <-----stopping here
super.postProcessMappings(config);
}
But when run again , the programe stopping at config.addClass(User.class), and don't throw exceptions.
So, I am very confused, Because I use OSGi in my Application, must map my entites dynamiclly.
Help me, Please mail to 576240289@qq.com , thank you !!


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

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.