Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 150 Time: 15:06 - Sep 13, 2007  

gfinzer

How do you delete a record with NHibernate with a composite key where one column is nullable?

I have the NHibernate mapping file set up correctly for my Marketing List object but I can't delete a record because of the null value in the composite key (I didn't set up the database and the database column can't be changed because of other systems). I get the standard Unexpected row count: 0; expected: 1

Can I do a CreateSQL or CreateHQL to do the delete?

Below is the SQL that NHibernate is spitting out:
DELETE FROM MARKETING_LIST WHERE FK_MJ_MJ_NUMBER = :p0 AND FK_MV_MV_NUMBER = :p1 AND LIST_SYSID = :p2 AND INS_COVERAGE_SUBTYPE = :p3; :p0 = '53494', :p1 = '101', :p2 = '10101', :p3 = ''

Below is the important pieces of the NHibernate Mapping. InsuranceCoverageSubtype is a nullable character column.

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
 namespace="Affinion.M1.Business"
 assembly="Affinion.M1.Business"
 default-access="field.camelcase-underscore">

 <!-- NHibernate mapping for Marketing List (Corresponds to table CUC_CONTROL.MARKETING_LIST) -->
 <class name="MarketingList" table="MARKETING_LIST" mutable="true" lazy="true">

  <!--Primary Key-->
<composite-id>
<key-property name="MarketingJobNumber" column="FK_MJ_MJ_NUMBER" />
<key-property name="MarketingVersionNumber" column="FK_MV_MV_NUMBER" />
<key-property name="ListId" column="LIST_SYSID" />
<key-property name="InsuranceCoverageSubtype" column="INS_COVERAGE_SUBTYPE" />
</composite-id>

<!--Properties-->
<property name="Quantity" column="QUANTITY" />
<property name="DeleteFlag" column="DELETE_FLAG" />

Categories

Answer Discussion
Tutorials

 

nicholascage

Date:: Oct 06, 2010

Time:: 05:08

Restall it or you could visit the customer service.

http://www.neu92.com/

admin

Date:: Mar 31, 2012

Time:: 13:55

The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.

The Quomon Team

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es