Hello guys.

 

This is my first post here. I'm new at NHibernate, I've been using it for
about only 6 months. So, I'm sorry if my doubt is too simple. I'm facing
some problems in using one-to-one relationships, where the entities use a
composite-id. Here is my scenario:

 

I have two entities: A and B. Both have two columns as primary key: Col1
(Int32) and Col2 (String).

 

Here are my mapping files:

 

<class name="A" table="tbA" lazy="true">

<composite-id name="A_ID" class="A_ID">

<key-property name="Col1" column="Col1" type="Int32" />

      <key-property name="Col2" column="Col2" type="String" length="6" />

</composite-id>

<one-to-one name="B" class="B" property-ref="A_ID" />

 

<class name="B" table="B" lazy="true">

<composite-id name="A_ID" class="A_ID">

      <key-property name="Col1" column="Col1" type="Int32" />

      <key-property name="Col2" column="Col2" type="String" length="6" />

</composite-id>

 

I have a generic repository class, where I've implemented some methods:
findAll, findByID, insert, update and delete.

 

I can insert, update, delete and findByID, but I can't execute findAll
method. When I try to execute it, I get the following error message:

"Unable to resolve property A_ID".

 

To findAll and findByID methods, I'm using ICriteria interface. The only
difference between these methods is that, in the findByID, I've added and
Expression to match the PK with the values passed by the parameters.

 

Unfortunately, I can't change the database schema, because it's a legacy
system.

 

I don't know what I'm doing wrong. Can someone help me, please?

 

Thanks in advance.

 

Best regards,

Renato Duran


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

Reply via email to