Deleting composite-elements with Clob properties fails in Oracle

11 views
Skip to first unread message

cremor

unread,
Oct 28, 2010, 11:36:00 AM10/28/10
to nhusers
Doesn't NHibernate (3.0.0.Beta1) support deleting (or updating, which
results in delete and insert) composite-elements, that have Clob
properties, in sets with an Oracle DB?
(The same should be true for simply using Clobs in a where clause of a
query, but I didn't try this.)

I'm using the Oracle10g dialect with the ODAC 11.2.0.1.2 driver on a
11.2.0.1.0 DB.

The generated SQL is the following:

DELETE
FROM
WORKFLOWBEDINGUNGEN
WHERE
WOF_ID = :p0
AND BEDINGUNGSFELD = :p1
AND WERT1 = :p2
AND WERT2 = :p3
AND BEDINGUNG = :p4
AND WOF_CODE = :p5;
:p0 = 241 [Type: Int64 (0)], :p1 = 'Bedingung' [Type: String (0)], :p2
= 'Wert1' [Type: String (0)], :p3 = 'Wert2' [Type: String (0)], :p4 =
'EGAL' [Type: String (0)], :p5 = 1 [Type: Int32 (0)]

The columns WERT1 and WERT2 are Clobs.
The statement fails with the exception
"Oracle.DataAccess.Client.OracleException ORA-00932: inconsistent
datatypes: expected - got CLOB".

I seems like you can't compare Clobs in Oracle using the "=" operator,
this doesn't work in SqlPlus too. At least in plain SQL, Google
searching says it should work in PL/SQL.

Is this a limitation of NHibernate?
If yes, is it possible to extend NHibernate somewhere to fix this? For
example by using "dbms_lob.compare()" instead of "=" for comparison of
Clobs?

Diego Mijelshon

unread,
Oct 30, 2010, 8:35:00 AM10/30/10
to nhu...@googlegroups.com
You'll have better results by converting that composite-element into an entity.
 
    Diego



--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.


cremor

unread,
Nov 3, 2010, 2:47:39 AM11/3/10
to nhusers
Why should I make something an entity thats lifecycle depends on his
parent and should never be referenced by something other than his
parent?
My current workaround is to use an idbag instead of the set.

I completely understand that NHibernate can't support all types of
Clobs in all DB systems. But then I'd like to point you to my other
message, where you can see that it even fails with simple nullable
datatypes:
http://groups.google.com/group/nhusers/browse_thread/thread/fe2e05bff0dc0b82
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>
> > .

Diego Mijelshon

unread,
Nov 3, 2010, 4:03:35 PM11/3/10
to nhu...@googlegroups.com
I think you have the value-object concept wrong: the fact that an object's lifetime depends on its parent has nothing to do with it.
It's the same as an InvoiceLine: it depends on the parent, but it has an identity, because determining it based on the values is suboptimal.
 
    Diego


To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages