views:

126

answers:

2

I am working with oracle and nhibernate. I can select list of an object from db table (all items in table) as Iquerable, but when I try to select an item from the list using "linq where clause" it sends nonsense query to oracle db. And it gets invalid identifier error.

I can get whole list without any error in query, it happens when I use where clause.

(Some information about query and mapping document is as below) query :

SELECT this_.ID as ID33_0_,
this_.BUNDLEID.........................Where bundleitem1_.ID = :p0

(bundleitem1_.ID is invalid)

related mapping part :

<component name="BundleItem"
class="PromissoryNotes.Server.Data.Bundle,
PromissoryNotes.Server.Data">
     <property name="Id" column="BUNDLEID" type="decimal"></property>

Copmponent "Bundle" has a mapping seperatly in another xml document, I realized that, when I change the Bundle class to another unmapped class, it works. Problem is about component with mapped classes as Bundle. What is the solution, any idea?

+2  A: 

Are you sure this should really be mapped as a component? Should this perhaps be a many-to-one mapping?

Perhaps something like:

<many-to-one name="BundleItem" column="BundleId" cascade="save-update" />
Krazzy
Thanks for your idea but it can't be like this, it has to be component.
NetSide
+2  A: 

I see that, this is an nhibernate bug. Mapped class could not be used as a component.

NetSide