Hi,
I've been using Hibernate for a few weeks now, and have figured out
how I can get what I want out of the database. However, when I run the
query that I've created, it seems that the performance is not that
great. Is there a more efficient way to structure my query?
I have basically two tables, Trail and Segment, where each Trail has
many Segments. I'm using NHibernate.Spatial to select all the
segments within a given area (Minimum Bounding Rectangle). The result
should be an array of distinct Trails, with each trail having a
collection containing one or more Segments. Here is the table
structure:
CREATE TABLE trail
(
trail_id BIGINT UNSIGNED NOT NULL,
trail_name VARCHAR(50) NOT NULL,
CONSTRAINT PRIMARY KEY (trail_id)
)
CREATE TABLE segment
(
seg_id BIGINT UNSIGNED NOT NULL,
trail_id BIGINT UNSIGNED NOT NULL,
line LINESTRING NOT NULL,
CONSTRAINT PRIMARY KEY (seg_id)
)
Here is my query:
IList<Trail> trails = session.CreateCriteria(typeof(Trail))
.SetResultTransformer(new
DistinctRootEntityResultTransformer())
.CreateCriteria("Segments")
.Add(SpatialExpression.Filter("Line", new
Envelope(x1, x2, y1, y2), 4326))
.List<Trail>();
I'm open to using whatever method is most efficient to get my required
results, CreateCriteria, HQL, Standard SQL, etc...
Thank you for the help,
Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---