I have a simple problem, but I can't find the solution.
I have a database table Driver that contains the columns FirstName and LastName (and lost of other columns). I have a corresponding object Driver with properties FirstName and LastName. My user requirements ask me to search for a user using 'Lastname Firstname'. How can I do this? Since names can contain spaces in both Firstname and Lastname, there is no way for me to determine where the lastname ends and the firstname begins. In SQL I would use
Code:
SELECT * FROM DRIVER
WHERE NameEntered = Lastname || ' ' || Firstname
When I try this in NHibernate, I get the following exception: undefined alias or unknown mapping: NHibernateTest [from NHibernateTest.Driver dr where :Name = dr.LastName || ' ' || dr.FirstName].
Can anyone point me towards a solution for this?
Thanks
Peter