码迷,mamicode.com
首页 > Web开发 > 详细

Hibernate异常之cascade

时间:2018-03-12 11:10:29      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:inter   uil   asc   lis   .exe   lambda   point   文件   callback   

  1 org.hibernate.MappingException: Unsupported cascade style: delete-option
  2     at org.hibernate.engine.spi.CascadeStyles.getCascadeStyle(CascadeStyles.java:257)
  3     at org.hibernate.mapping.Property.getCascadeStyle(Property.java:140)
  4     at org.hibernate.mapping.Property.getCollectionCascadeStyle(Property.java:127)
  5     at org.hibernate.mapping.Property.getCascadeStyle(Property.java:102)
  6     at org.hibernate.tuple.PropertyFactory.buildEntityBasedAttribute(PropertyFactory.java:229)
  7     at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:202)
  8     at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:519)
  9     at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:124)
 10     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 11     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 12     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 13     at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
 14     at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96)
 15     at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77)
 16     at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:128)
 17     at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:300)
 18     at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460)
 19     at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)
 20     at pw.fengya.strategy.TestHibernate.init(TestHibernate.java:26)
 21     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 22     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 23     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 24     at java.lang.reflect.Method.invoke(Method.java:483)
 25     at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:389)
 26     at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
 27     at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeMethodInExtensionContext(ClassTestDescriptor.java:289)
 28     at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$11(ClassTestDescriptor.java:277)
 29     at org.junit.jupiter.engine.descriptor.ClassTestDescriptor$$Lambda$153/1157740463.invokeBeforeEachMethod(Unknown Source)
 30     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$null$2(TestMethodTestDescriptor.java:132)
 31     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$171/597255128.execute(Unknown Source)
 32     at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
 33     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:152)
 34     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:131)
 35     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:106)
 36     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:57)
 37     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:83)
 38     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$$Lambda$133/1144648478.execute(Unknown Source)
 39     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
 40     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:77)
 41     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$null$2(HierarchicalTestExecutor.java:92)
 42     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$$Lambda$136/1681595665.accept(Unknown Source)
 43     at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
 44     at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
 45     at java.util.Iterator.forEachRemaining(Iterator.java:116)
 46     at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
 47     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
 48     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
 49     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
 50     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
 51     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
 52     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
 53     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:92)
 54     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$$Lambda$133/1144648478.execute(Unknown Source)
 55     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
 56     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:77)
 57     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$null$2(HierarchicalTestExecutor.java:92)
 58     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$$Lambda$136/1681595665.accept(Unknown Source)
 59     at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
 60     at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
 61     at java.util.Iterator.forEachRemaining(Iterator.java:116)
 62     at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
 63     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
 64     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
 65     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
 66     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
 67     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
 68     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
 69     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:92)
 70     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$$Lambda$133/1144648478.execute(Unknown Source)
 71     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
 72     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:77)
 73     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:51)
 74     at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
 75     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
 76     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
 77     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
 78     at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:86)
 79     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 80     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
 81     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
 82     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
 83     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
 84     Suppressed: java.lang.NullPointerException
 85         at pw.fengya.strategy.TestHibernate.destory(TestHibernate.java:39)
 86         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 87         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 88         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 89         at java.lang.reflect.Method.invoke(Method.java:483)
 90         at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:389)
 91         at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
 92         at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeMethodInExtensionContext(ClassTestDescriptor.java:289)
 93         at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$synthesizeAfterEachMethodAdapter$12(ClassTestDescriptor.java:281)
 94         at org.junit.jupiter.engine.descriptor.ClassTestDescriptor$$Lambda$156/1582797472.invokeAfterEachMethod(Unknown Source)
 95         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$null$9(TestMethodTestDescriptor.java:208)
 96         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$195/1112758237.execute(Unknown Source)
 97         at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
 98         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$13(TestMethodTestDescriptor.java:226)
 99         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$194/2108440536.accept(Unknown Source)
100         at java.util.ArrayList.forEach(ArrayList.java:1234)
101         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAllAfterMethodsOrCallbacks(TestMethodTestDescriptor.java:224)
102         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAfterEachMethods(TestMethodTestDescriptor.java:207)
103         at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:114)
104         ... 48 more

Hibernate创建双向一对多关联关系时报错,报错信息:org.hibernate.MappingException: Unsupported cascade style: delete-option,原因是在这个配置文件是从上一个项目中直接复制的,配置文件中没有去掉cascade="delete-option",去掉后正常运行

<set name="orders" table="ORDERS" inverse="true" cascade="delete-option">
            <key column="CUSTOMER_ID" />
            <one-to-many class="Order" />
</set>

 

Hibernate异常之cascade

标签:inter   uil   asc   lis   .exe   lambda   point   文件   callback   

原文地址:https://www.cnblogs.com/lxc-2017/p/8547915.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!