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: Closed Points: 180 Time: 10:59 - Jul 09, 2008  

Slevin

What's wrong with mapping file.

I have next classes :

public class TechnoCardItem :
{
public virtual string Name
{
get;
set;
}

public virtual double Proporcion
{
get;
set;
}

public virtual double LowBound
{
get;
set;
}

public virtual double UpBound
{
get;
set;
}

public TechnoCardItem()
{
}

public TechnoCardItem(string element, double proporcion, double lowBound, double upBound)
{
this.Name = element;
this.Proporcion = proporcion;
this.LowBound = lowBound;
this.UpBound = upBound;
}
}

public class TechnoCardItemInput : TechnoCardItem
{
}

public class TechnoCardItemOutput : TechnoCardItem
{
}


public class TechnoCard
{
public string Name
{
get;
set;
}

public IList<TechnoCardItemInput> Input
{
get;
set;
}

public IList<TechnoCardItemOutput> Output
{
get;
set;
}

public TechnoCard()
{
ConstructorInits();
}

public TechnoCard(string Name)
{
this.Name = Name;
ConstructorInits();

}

private void ConstructorInits()
{
Input = new List<TechnoCardItemInput>();
Output = new List<TechnoCardItemOutput>();
}
}

and next mapping files for NHibernate :

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="DeliveryNoteHandler.Core.Domain.TechnoCard, DeliveryNoteHandler.Core" table="TechnoCards" lazy="false">

<id name="ID" column="TechnoCardID" unsaved-value="0">
<generator class="increment" />
</id>

<property name="Name" column="Name" />

<bag name="Input" cascade="all" inverse="true">
<key column="TechnoCardID" />
<one-to-many class="DeliveryNoteHandler.Core.Domain.TechnoCardItemInput, DeliveryNoteHandler.Core" />
</bag>

<bag name="Output" cascade="all" inverse="true">
<key column="TechnoCardID" />
<one-to-many class="DeliveryNoteHandler.Core.Domain.TechnoCardItemOutput, DeliveryNoteHandler.Core" />
</bag>

</class>
</hibernate-mapping>



<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="DeliveryNoteHandler.Core.Domain.TechnoCardItem, DeliveryNoteHandler.Core" table="TechnoCardItems" lazy="false">

<id name="ID" column="TechnoCardItemID" unsaved-value="0">
<generator class="increment" />
</id>

<discriminator column ="Flag" type="String" />
<property name="Name" column="Name" />
<property name="Proporcion" column="Proporcion" />
<property name="LowBound" column="LowBound" />
<property name="UpBound" column="UpBound" />
<subclass name="DeliveryNoteHandler.Core.Domain.TechnoCardItemInput, DeliveryNoteHandler.Core" discriminator-value="0" />
<subclass name="DeliveryNoteHandler.Core.Domain.TechnoCardItemOutput, DeliveryNoteHandler.Core" discriminator-value="1" />

</class>
</hibernate-mapping>

The problem is when I create TechnoCard from dataBase, element Flag in database is not compered with "0" or "1" and every item goes to Input list.

Categories

Answer Discussion
Tutorials

 

gonzalo

Date:: Jul 19, 2008

Time:: 21:13

The property ID on the TechnoCardItem class is not defined.

admin

Date:: Mar 04, 2009

Time:: 10:09

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

Question Answered

This question has been closed, and points have been rewarded to the following experts:


gonzalo: 90
admin: 90

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

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?

No tutorials have been submitted yet. Want to be the first?

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?

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