-->
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 Inheritance Question
PostPosted: Thu Jun 03, 2010 8:26 am 
Newbie

Joined: Thu Jun 03, 2010 8:21 am
Posts: 1
Hi Everyone,

I am from turkey. I am developing a application with nhibernate. In the all my tables there is three columns as

row_guid
row_version
row_status. I have write a class like this

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

namespace Maniac.Core.Database
{
public abstract class MncDbObject
{
#region Fields

private Guid rowGuid;
private long rowVersion;
private int rowStatus;

#endregion

#region Properties

public virtual Guid RowGuid
{
get { return rowGuid; }
set { rowGuid = value; }
}

public virtual long RowVersion
{
get { return rowVersion; }
set { rowVersion = value; }
}

public virtual int RowStatus
{
get { return rowStatus; }
set { rowStatus = value; }
}

#endregion

#region Methods
public void Delete()
{
MncDbSessionManager.GetSession().Delete(this);
}

public void Save()
{
MncDbSessionManager.GetSession().Save(this);
}

public void SaveOrUpdate()
{
MncDbSessionManager.GetSession().SaveOrUpdate(this);
}

public void Update()
{
MncDbSessionManager.GetSession().Update(this);
}
#endregion
}
}

. This is my base table class and my all entities will extends this. But i create an appropriate hbm.xml file for tables. So i want to write a pojo like this.

using System;
using System.Collections.Generic;
using System.Text;
using Maniac.Core.Database;

namespace Maniac.Core.Test2
{
public class DenemeTablo1 : MncDbObject
{
#region Fields

private string adi;
private string soyadi;

#endregion

#region Properties

public virtual string Adi
{
get { return adi; }
set { adi = value; }
}

public virtual string Soyadi
{
get { return soyadi; }
set { soyadi = value; }
}

#endregion
}
}. Table of this pojo has 5 five columns. 3 of these is in the base class.

Can u help me how to create a DenemeTablo1.hbm.xml file.

Thanks


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.