-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: nhibernate romeve donsen't work
PostPosted: Fri Oct 02, 2009 3:19 pm 
Newbie

Joined: Fri Oct 02, 2009 2:53 pm
Posts: 1
I'm building a web application in Visual studio .net 2008, using Nhibernate.

I cant not remove an item from a bag(list).

I have this definition:

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

<class name="DetallesPj" table="detalles_PJ">

<id name="ClienteKey" column="cliente_id" type="Int32" unsaved-value="0">
<generator class="foreign">
<param name="property">Cliente</param>
</generator>
</id>
<one-to-one name="Cliente" class="Cliente" constrained="true"/>
<bag name="ContactoList" cascade="all" inverse="true">
<key column="cliente_id" />
<one-to-many class="Contacto" />
</bag>
<property column="nombre" type="String" name="Nombre" not-null="true" length="256" />
<property column="gerente_general" type="String" name="GerenteGeneral" length="256" />
<property column="direccion" type="String" name="Direccion" length="1024" />
<many-to-one name="Actividad" column="actividad_id" class="Actividad" />
<property column="web_address" type="String" name="WebAddress" length="1024" />
<property column="numero_empresas" type="Int32" name="NumeroEmpresas" />
<property column="cedula_persona_juridica" type="String" name="CedulaPersonaJuridica" not-null="true" length="20" />
<property column="telefono" type="String" name="Telefono" length="20" />
<property column="fax" type="String" name="Fax" length="20" />
<property column="email" type="String" name="Email" length="256" />
<many-to-one name="Area" column="area_id" class="Area" />

</class>

</hibernate-mapping>


this bag holds a list f contact wich i show in a repeater y my page, repaeater definition is like this:

<td colspan="2">
<div class="scroller" style="height: 80px; width: 100%" >
<asp:Repeater ID="rptContactos" runat="server" OnItemCommand="rptContactos_ItemCommand">

<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#86b1c3" >
</HeaderTemplate>
<ItemTemplate>
<asp:HiddenField ID="h_ContactKey" runat="server" Value='<%# Eval("Contacto")%>' />
<tr id="trContacto" runat="server" class="rowOut" onmouseout="if(this.className!='rowSelected')this.className='rowOut'" onmouseover="if(this.className!='rowSelected')this.className='rowOver'">
<td align="center" nowrap="nowrap" width="10">
<asp:LinkButton ForeColor="#000000" ID="link1" runat="server" Width="100%" CommandArgument='<%# Eval("Contacto") %>'>
<img id="imgCheck" style="border: 0px; margin-right: 5px" runat="server" alt="Proyecto Seleccionado" src="../images/check.gif" visible="False" /><%# Eval("Contacto")%></asp:LinkButton>
</td>
<td align="left" nowrap="nowrap" width="90px" >
<asp:LinkButton ForeColor="#000000" ID="lblCedulaentidad" runat="server" Width="100%" CommandArgument='<%# Eval("Contacto")%>'><%# Eval("Cedulaentidad")%></asp:LinkButton></td>
<td align="left" nowrap="nowrap">
<asp:LinkButton ForeColor="#000000" ID="lblNombre" runat="server" Width="100%" CommandArgument='<%# Eval("Contacto")%>'><%# Eval("Nombre")%></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</td>


and this button defined to eliminate an item of contactlist and this is the code wrote for this:

int selCliente = Convert.ToInt32(h_selectedCliente.Value);
Cliente cli = ClienteFactory.GetById(selCliente);
int contId = Convert.ToInt32(h_ContactKey.Value);
Contacto DelContacto = ContactoFactory.GetById(contId);
cli.DetallesPj.ContactoList.Remove(DelContacto);


and it seem to be ok first time, but the second time i try to remove an element I get the first element erased back in the list and, so for me was never erased.

Can someone tell me why is this why can it be removed?
thank's


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.