| Author |
Message |
|
2007/04/13 17:22
|
|
|
rosdikasim@gmail.com
Joined: 2007/04/13
Messages: 9
Offline
|
|
|
|
I am trying to load an object using the generated LoadXXXByQuery. But I could not get it to understand my query string.
Example,
Car car = CarFactory.LoadCarByQuery("where car.Owner.ORMID = '1'", null)
|
Basically I am trying to get a car owned by a specific Owner. But NHibernate keeps throwing exception like so..
could not resolve property:Owner of :Lesen.Car [From Lesen.Car as Car Where Car.Owner.ORMID = '1']
|
Lesen is the package name for my classes.
Any code sample that explains how to use this function would be good.
|
|
|
|
 |
| |
|
2007/04/14 09:46
|
|
|
Jick
Joined: 2005/04/29
Messages: 2880
Offline
|
|
|
|
Hello rosdikasim,
Try this:
Car car = CarFactory.LoadCarByQuery("Car.owner.id = 1", null);
PS. Notice that the statement is case sensitive. We assume that Car starts with capital letter 'C', and owner starts with small letter 'o'.
Best regards,
Jick
|
Visual Paradigm International Ltd.
http://www.visual-paradigm.com
Build Quality Applications Faster, Better and Cheaper |
|
|
|
 |
| |
|
2007/04/14 20:23
|
|
|
rosdikasim@gmail.com
Joined: 2007/04/13
Messages: 9
Offline
|
|
|
|
Duh!.. I didnt realize that I am supposed to refer to the "name" property in the mapping file and not the class name!
So the correct query is "Car.ORM_Owner.Id = 1"
Everything work fine now. TQ.
|
|
|
|
 |
| |
|
2007/04/16 08:40
|
|
|
Jick
Joined: 2005/04/29
Messages: 2880
Offline
|
|
|
|
|
 |
| |