as i stated in my reply, the value is being retrieved via query.
more verbose detail:
dbConn.Open();
DbCommand dbc = dbConn.CreateCommand();
dbc.CommandText = "SELECT [SeqName].NEXTVAL FROM dual";
ticketNumber = dbc.ExecuteScalar().ToString();
the database is oracle 10g.
I'm not an oracle wizard by any stretch of the imagination, so I'm not
sure how i would go about having the value be generated on insert. I'd
imagine a trigger of some sort could be used.
Assuming that's true: If i have a trigger on the table to generate the
(non-ID) value from this sequence on insert (only), will NH pull that
value back into the entity?
I'm confused by you having no idea how to map the property name to the
State collection (which is what's persisted to database).
It's obviously mapped somehow by NH, soo ... ?
(I suppose that's an NH, not FNH question, so perhaps my confusion
with your lack of insight is misplaced.)
after playing around, i figure this MIGHT work, but I'm not confident
that these 2 collections are always synchronized.
int propertyIndex = 0;
foreach (string prop in
piEvent.Persister.PropertyNames)
{
if (prop == "TicketNumber")
break;
else
propertyIndex ++;
}
piEvent.State[propertyIndex] = ticketNumber;
all of this feels like a very kludgey hack: Is the limitation of not
being able to use sequence generators on non-ID-mapped fields a NH or
FNH shortcoming?
On Dec 8, 7:17 pm, James Gregory <[email protected]> wrote:
> I have no idea.
>
> You say you want to set this property to the value of a DB sequence,
> where's this sequence coming from? How do you get the value? Can it not
> be a generated column in the db?
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en.