Does hibernate support user defined types in bulk update query? Or i do someth wrong?
Hibernate version:
3.0.5
Mapping documents:
Code:
<hibernate-mapping>
<class
name="de.***.bbs.model.Order"
table="BBS_ORDER">
<id
access="field"
column="BBS_ORDER_ID"
length="10"
name="orderId"
type="string">
<generator class="assigned" />
</id>
<version
name="lastModificationDate"
column="BBS_ORDER_LAST_MODIFICATION_DATE"
type="timestamp" />
<many-to-one
name="client"
cascade="save-update"
column="BBS_ORDER_CLIENT_ID"
lazy="true"
not-null="true"
access="field"
class="de.***.bbs.model.Client"
foreign-key="FK__ORDER_CLIENT" />
<property
name="status"
column="BBS_ORDER_STATUS"
not-null="true"
type="de.***.bbs.model.hbm.types.OrderStatusType"
length="15" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
Transaction tx = getSession().beginTransaction();
String q = "update de.***.bbs.model.Order set status = :status where client = :c";
getSession().createQuery(q).setParameter("status", OrderStatus.incasso).setParameter("c", c).executeUpdate();
tx.commit();
Full stack trace of any exception that occurs:Code:
org.hibernate.HibernateException: Could not determine a type for class: de.***.bbs.model.OrderStatus
at org.hibernate.impl.AbstractQueryImpl.guessType(AbstractQueryImpl.java:471)
at org.hibernate.impl.AbstractQueryImpl.guessType(AbstractQueryImpl.java:455)
at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:448)
at de.***.bbs.ui.actions.folders.MoveToInkassoUpdate.testBulkUpdate(MoveToInkassoUpdate.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Name and version of the database you are using:
MySql 4.1 stream