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: Update ID
PostPosted: Tue Jul 17, 2007 3:19 pm 
Newbie

Joined: Tue Jul 17, 2007 3:09 pm
Posts: 1
Hello,

I like to update Id in Database of table X, I use Session.UpDate(Objet, Id), but it is not changed.

I give Fiche HBM
---------------------
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="nFormatin">
<class name="nFormation.Devise, nFormation" table="T_DEVISE">

<id name="clsDevise" unsaved-value="1">
<column name="deDevise" sql-type="nvarchar(10)" not-null="false"/>
<generator class="native"/>
</id>

<property name="clsDesignation" type="String">
<column name="deDesignation"/>
</property>

<property name="clsPays" type="String">
<column name="Pays"/>
</property>

</class>
</hibernate-mapping>
----------------------------------


// Class Devise.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace nFormation
{
/// <summary>
/// Objet devise.
/// </summary>
public class Devise
{
public Devise()
{
}

public Devise(String Devise, String Designation, String Pays)
{
clsDesignation = Designation;
clsDevise = Devise;
clsPays = Pays;
}

private String _devise;
/// <summary>
/// La devise.
/// </summary>
public virtual string clsDevise
{
get
{
return _devise;
}
set
{
_devise = value;
}
}

private String _designation;
/// <summary>
/// La désignation de la devise.
/// </summary>
public virtual string clsDesignation
{
get
{
return _designation;
}
set
{
_designation = value;
}
}

private String _pays;
/// <summary>
/// Le pays.
/// </summary>
public virtual string clsPays
{
get
{
return _pays;
}
set
{
_pays = value;
}
}
}
}

----------------------------------
private void btnModifier_Click(object sender, EventArgs e)
{
ISession s = NhibernateSessionFactory.openSession();
ITransaction tx = s.BeginTransaction();
Devise d = new Devise(txtDevise.Text, txtDesignation.Text, txtPays.Text);


s.Update(d, txtOldId);

tx.Commit();
s.Disconnect();
}

-*-------------------------------

Think

_________________
http://www.Tawory.com


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.