-->
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: I have a problem about serialize entity model
PostPosted: Sun Apr 10, 2011 11:01 pm 
Newbie

Joined: Sun Apr 10, 2011 10:34 pm
Posts: 1
I have a hbm file like this:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false" namespace="Test.Domain.Seasons" assembly="Test.Domain">
   <class name="SaleSeason" table="TSP.SALESEASONS">

      <!-- Primary Key(s) -->
      <id name="Id" column="ID" type="Int32" unsaved-value="0">
         <generator class="assigned"/>
      </id>
      
      <!-- Properties -->
      <property column="NAME" type="String" name="Name" length="50" />
      
   </class>
</hibernate-mapping>


The model file is like this:
Code:
   public class SaleSeason
   {
      #region Private Members
      
      // Variabili di stato
      private bool _isChanged;
      private bool _isDeleted;

      // Primary Key(s)
      private int _id;
      
      // Properties
      private string _name;

      #endregion
      
      #region Default ( Empty ) Class Constructor
      
      /// <summary>
      /// default constructor
      /// </summary>
      public SaleSeason()
      {
         _id = 0;
         _name = null;
      }
      
      #endregion // End of Default ( Empty ) Class Constructor
      
      #region Full Constructor
      
      /// <summary>
      /// full constructor
      /// </summary>
      public SaleSeason(int id, string name)
      {
         _id = id;
         _name = name;
      }

      /// <summary>
      /// PK Unique ID, Entered Manually
      /// </summary>      
      [DataMember]      
      public int Id
      {
         get { return _id; }
         set { _isChanged |= (_id != value); _id = value; }
      }
.............................
.............................


And I have writen a service to return a SaleSeason object,the service contract is :

[OperationContract]
SaleSeason UpdateSaleSeason(SaleSeason season);

I also have a silverlight client, but when I invoke the service on the silverlight client,even I have set a value to Id,but on the service client,the received object's id is always 0 . I don't know how to set the value of Id.
Does anybody know why? and how to solve this problem?


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.