[hibernate-issues] [Hibernate-JIRA] Updated: (ANN-574) CascadeType ALL is not equals to REMOVE+REFRESH+PERSIST+MERGE

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Mar 15 13:35:09 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-574?page=all ]

Emmanuel Bernard updated ANN-574:
---------------------------------

    Component: documentation

> CascadeType ALL is not equals to REMOVE+REFRESH+PERSIST+MERGE
> -------------------------------------------------------------
>
>          Key: ANN-574
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-574
>      Project: Hibernate Annotations
>         Type: Bug

>   Components: documentation
>     Versions: 3.2.1
>     Reporter: Pascal Alberty
>     Assignee: Emmanuel Bernard
>      Fix For: 3.3.0.ga

>
>
> Entity1
>  With a list of entity2
>  @OneToMany
> Entity2
>  With a field on entity1
>  @ManyToOne
>  @JoinColumn(nullable=false)
> Entity2 created with a mock by using Spring injection. 2 beans configured. One Entity2, one Entity1. Entity2 linked to Entity1
> JUnit test trying to persist a entity2.
> The test fails if no CascadeType is configured  (see below)
> The test runs if CascadeType is configured to ALL
> The test fails if CascadeType is configured to REMOVE+REFRESH+PERSIST+MERGE !!!!!
> So REMOVE+REFRESH+PERSIST+MERGE != ALL as noted in http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#d0e1546
> org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign
> Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.xxx.dto.campaign.TechnicalComponent.campaign
> 	at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
> 	at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
> 	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
> 	at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
> 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
> 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
> 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
> 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
> 	at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
> 	at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
> 	at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
> 	at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:679)
> 	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
> 	at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:676)
> 	at com.beweb.adbox.dao.impl.BaseDaoHibernate.saveObject(BaseDaoHibernate.java:24)
> 	at com.xxx.xxx.dao.campaign.impl.ComponentDaoHibernate.saveComponent(ComponentDaoHibernate.java:53)
> 	at com.xxx.xxx.dao.campaign.ComponentDaoTest.testSaveComponent(ComponentDaoTest.java:24)
> 	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 junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list