Found out the cause for the problem. If you have two embedded objects,say, bill to and ship to address and one of them is not required(ship to in this case). Then for the second one you can not pass a null object. In my test class I had to create a new address object with no values set and set it on the parent entity's ship to address and then save it. This way hibernate did not complain, but I did not do this in 2m5. So my first question still stands: What has changed wrt hibernate versions between 2m5 and 2rc1? Matt I think only you can tell us :)
arvinder wrote: > > I created a new basic struts 2rc1 project with hibernate and moved my > application source code from 2m5 project (in which i had run full source, > in new project I do not intend to do full source). Now my tests for > persistant entities which have embedded objects are failing, throwing the > hibernate exception below. Other tests run fine. > In my 2m5 project all the tests are running fine. > So my questions are > > Has anything changed wrt hibernate versions between 2m5 and 2rc1? > Does anybody have embedded objects in their 2rc1 project (not full > sourced)? > > If somebody has it working please drop a line, then I would know that that > there is something wrong in my code. But this seems highly unlikely, as > this exception is coming from the guts of hibernate, and while debugging I > found, in org.hibernate.type.TypeFactory.replaceAssociations class, that > my embedded entity as well as the parent entity have correct values but on > return from a method both are null. > I found a similar issue > http://opensource.atlassian.com/projects/hibernate/browse/HHH-2316 > but I am not sure how closely it is related to that. > > Thanks, > Arvinder > > testAddAndRemoveCompany(com.ss.silitrucker.dao.CompanyDaoTest) Time > elapsed: 0.047 sec <<< ERROR! > java.lang.NullPointerException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145) > at > org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64) > at > org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70) > at > org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:83) > at > org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353) > at > org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:348) > at > org.hibernate.type.TypeFactory.replaceAssociations(TypeFactory.java:556) > at > org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:366) > at > org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:195) > at > org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123) > at > org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53) > at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677) > at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661) > at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665) > at > org.springframework.orm.hibernate3.HibernateTemplate$23.doInHibernate(HibernateTemplate.java:765) > at > org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372) > at > org.springframework.orm.hibernate3.HibernateTemplate.merge(HibernateTemplate.java:762) > at > org.appfuse.dao.hibernate.GenericDaoHibernate.save(GenericDaoHibernate.java:64) > at > com.ss.silitrucker.dao.CompanyDaoTest.testAddAndRemoveCompany(CompanyDaoTest.java:35) > at > com.ss.silitrucker.dao.CompanyDaoTest.testAddAndRemoveCompany(CompanyDaoTest.java:35) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > ........ > :confused::confused::confused: -- View this message in context: http://www.nabble.com/Hibernate-exception-in-2rc1-tf4163486s2369.html#a11847455 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
