Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0.2
Full stack trace of any exception that occurs:
Code:
org.hibernate.MappingException: Unsupported cascade style: create
at org.hibernate.engine.Cascades.getCascadeStyle(Cascades.java:961)
at org.hibernate.mapping.Property.getCascadeStyle(Property.java:92)
at org.hibernate.tuple.PropertyFactory.buildStandardProperty(PropertyFactory.java:127)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:149)
at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:401)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:206)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
at be.rmi.intranet.db.HibernateConnectionFactory.<init>(HibernateConnectionFactory.java:68)
at be.rmi.intranet.db.HibernateConnectionFactory.getInstance(HibernateConnectionFactory.java:116)
at be.rmi.intranet.VacancyManagerTest.testGetCurrentManager(VacancyManagerTest.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)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
Name and version of the database you are using:Oracle 8The generated SQL (show_sql=true):According to Hibernate 3.02 doc chapter 10.11 'Transitive Persistence' it is possible to casacade the creation operation on associations. I did add a cascade="create,save-update" on all associations i used to achieve this. however, Hibernates throws a Exception telling the 'create' cascade is not supported. any idea why?
Mapping used:Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="be.rmi.intranet.db.users" default-lazy="true">
<class name="be.rmi.intranet.db.users.FunctionBackup" table="USER_FCT_BACKUP" lazy="true">
<id name="id">
<column name="backup_id" not-null="true" unique="true" sql-type="NUMBER"/>
<generator class="sequence">
<param name="sequence">user_function_backup_seq</param>
</generator>
</id>
<property name="priority" column="PRIORITY" not-null="false"/>
<many-to-one name="function" column="fct_id" not-null="true" cascade="create,save-update"/>
<many-to-one name="user" column="empl_id" not-null="true"/>
</class>
</hibernate-mapping>