-->
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: Private vs. protected constructors...
PostPosted: Fri Apr 15, 2005 11:17 am 
Newbie

Joined: Thu Jan 20, 2005 12:21 pm
Posts: 9
Hi,

I have a general question about a difference between hibernate version 2.1.7-c and version 3.0.

We have used entities with private default constructors without any problems in Hibernate 2.1.7-c. These default constructors are declared private to make sure they can be used exclusively for OR mapping and not by application code.

Nevertheless, these same entities are now resulting in exceptions thrown by CGLIB (see at the end of this post) with the new hibernate version 3.

These exceptions do not cause any testcases to fail, but they are still annoying. I managed to get rid of the exceptions by declaring the constructors protected instead of private.

Has anything changed in the default configuration of CGLIB or Hibernate causing this behavior? Is it possible to configure Hibernate and CGLIB to get the old behavior back?

Cheers
Erik


[junit] 24527 [main] ERROR org.hibernate.proxy.BasicLazyInitializer - CGLIB Enhancement failed: com.upsscs.dragon.system.scheduling.DefaultSchedulingInfo
[junit] java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
[junit] at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:682)
[junit] at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:494)
[junit] at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
[junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
[junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:373)
[junit] at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:281)
[junit] at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:640)
[junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:94)
[junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:42)
[junit] at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:139)
[junit] at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83)
[junit] at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54)
[junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47)
[junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:212)
[junit] at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
[junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
[junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
[junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199)
[junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
[junit] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:568)
[junit] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:503)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1075)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:349)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)
[junit] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
[junit] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
[junit] at com.upsscs.dragon.persistence.test.ORMappingTestCase.setUp(Unknown Source)
[junit] at com.upsscs.dragon.persistence.hibernate.scheduling.SchedulingInfoPersistenceTest.setUp(Unknown Source)
[junit] at junit.framework.TestCase.runBare(TestCase.java:125)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:656)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)


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.