Mapping property value based on select statement and another property

0 views
Skip to first unread message

joe

unread,
Apr 27, 2009, 1:41:45 PM4/27/09
to nhusers
Hi,

In the system I am developing we have a field RequestNumber which is
used to identify the request ( by the end user. It's not a primary
key)

So for eg we have the following columns in the table
Id
RequestType (possible values: AIM, CMI, JMI)
RequestNumber
RequestDetail1
....
RequestDetailN

What I want in RequestNumber is AIM-10 if this is the 10th request of
RequestType AIM
JMI-120 if this is
the 120th request of RequestType JMI

Is there a way to define the RequestNumber in the mapping file so that
it uses the RequestType property and a select statement.

Maybe there is an easier way doing this.

I would appreciate if anyone can shed some light on this
Thanks
Joe

Fabio Maulo

unread,
Apr 29, 2009, 12:43:06 AM4/29/09
to nhu...@googlegroups.com
<any>

2009/4/27 joe <jmcdon...@gmail.com>



--
Fabio Maulo
Message has been deleted

joe

unread,
Apr 29, 2009, 9:58:10 PM4/29/09
to nhusers
Thanks for the reply.

I only found the following blog post that explains the <any>
association in any detail.
http://ayende.com/Blog/archive/2009/04/21/nhibernate-mapping-ltanygt.aspx

It looks like <any> association does not support using queries.

Basically the RequestNumber is comprised of 2 parts.
1. RequestType
2. Request count with RequestType in 1.

I suspect I will have to map the RequestNumber as a property and then
assign the value by running the query seperately.

What I am worried about is if there are 2 requests at about the same
time then the RequestNumber will no longer be unique.

Thanks
joe






On Apr 29, 12:43 am, Fabio Maulo <fabioma...@gmail.com> wrote:
> <any>
>
> 2009/4/27 joe <jmcdonald...@gmail.com>
Reply all
Reply to author
Forward
0 new messages