-->
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: one to one mapping from one table to the other
PostPosted: Tue Mar 09, 2010 5:11 pm 
Newbie

Joined: Tue Mar 09, 2010 4:57 pm
Posts: 1
i am trying to map a one table to the other , basic two primary keys. projectid to project id. how do i define that in the xml?

<class name="ProjectExts" table="project_exts" lazy="false">
<id name="ProjectID" column="PROJ_ID">
<generator class="foreign">
<param name="property">NewProjects</param>
</generator>
</id>
<property name="ProjectManagerName" column="PROJ_MGR_NAME" type="String"/>
<property name="ConstStatusCode" column="CONST_STAT_CD" type="String"/>
<property name="RecStatus" column="REC_STATUS" type="String"/>

and the other table

<class name="NewProjects" table="NEW_PROJECTS" lazy="false">
<id name="ProjExtId" column="PROJ_EXT_PROJ_ID">
<generator class="assigned"/>
</id>
<property name="Description" column="DESCR" type="String"/>
</class>

now the classes are.

[Serializable]
[DataContract(Namespace = "")]
public class NewProjects
{

[DataMember]
public string Description { get; set; }

[DataMember]
public string ProjExtId { get; set; }


}

and the other is
[Serializable]
[DataContract(Namespace = "TProDataTransferObjects")]
public class ProjectExts
{
[DataMember]
public string ProjectID { get; set; }

[DataMember]
public string ProjectManagerName { get; set; }


[DataMember]
public string ConstStatusCode { get; set; }

[DataMember]
public string RecStatus { get; set; }


}

and in my wcf i am trying to call the service to return the list for me.

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[NHibernateContext]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class NewProject
{
[OperationContract]
public void ViewNewProject()
{

using (ISession session = NHibernateContext.Current().Session)
{
IQuery query;
query = session.CreateQuery("from ProjectExts where RecStatus IN ('New','Ready To Approve','Ready To Schedule','Scheduled')");
var list=query.List();

}


}
}

i am new to nhibernate and i am trying to select to show 4 fields
ProjectManagerName ,
ConstStatusCode ,
RecStatus ,
Description

having lots of issues of where to add the mapping and the xml to show all fields.


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.