Assuming the following:
public class Order
{
public virtual int OrderId {get;set}
public virtual ISet<Product> Products {get;set}
}
public class Product
{
public virtual int ProductId {get;set}
public virtual string ProductName {get;set}
}
How would you query using the criteria api so that only an order with a specific o...
Hi!
I'm looking for an NHibernate criterion which does not add a restriction to a criteria. The reason for this is that I have a method which converts some input parameters into a criterion which is added to a criteria. There is a constellation of the input parameters where no restriction needs to by applied. Therefore I want to return ...
Hi,
After settling on Subversion as my RCS needs (and AnkhSVN/TortoiseSVN for my primary Subversion clients), I am trying to choose an SVN server. I have looked at a bunch of them:
Local (ie file:///)
Collabnet
VisualSVN Server
Tigris
SilkSVN
SharpSVN
Apache module
I’ve installed each in a VM to try them out but have not found enoug...
Given a class A related to another class B in a one-to-many relationship, how can you create an NHibernate query (using the Criteria API--no HQL) to find all objects A who "have none" of the related objects B? Specifics follow, but I wanted to get the question out there first.
I have two model classes, Sample and SampleDiagnosis. Sam...
I have list of category. I need a list of category by excluding 2,3 row. Can we achieve through hibernate by using Criteria and Restriction?
...
Hi,
I have been playing around with the AbstractSearchFilter featured in Ayende blog here. The idea is you abstract the query building for search to the UI. While I can see how it works for simplistic restriction queries I am struggling to see how this could be used for something such as subqueries on ID, which are very comment in my ap...
I have an object from my domain model that has a child object. How can I use a criteria query to order based on a property of the child?
For example:
class FooType
{
public int Id { get; set; }
public string Name { get; set; }
public BarType Bar { get; set; }
}
class BarType
{
public int Id { get; set; }
public st...
Hi !
Considering the following mapping file where TemporaryAccessOpenCommand and TemporaryAccessCloseCommand both inherit from base class Command
<class name="Command" table="xxx_Commands" lazy="false">
<id name="Id" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="BeginDate" />
<property name="EndD...
Hi,
This has been a 2 week battle for me so far with no luck. :(
Let me first state my objective. To be able to search entities which are tagged "foo" and "bar". Wouldn't think that was too hard right?
I know this can be done easily with HQL but since this is a dynamically built search query that is not an option. First some code:
p...
Hi,
How do you add NOLOCK when using nhibernate? (criteria query)
...
Good day,
I have a Hibernate mapping that looks something like this:
<class name="MyEntity">
<set name="scalarSet" table="(select fk, scalar_value from other_table)">
<key column="fk"/>
<property column="scalar_value" type="long"/>
</set>
</class
Given this, how do I query such that a value of MyEntity.scalarSet (which is...
Hi,
I have the following query which id like to sorty by "raceDate" and by "raceNo" asc. I can figure out how to sort by one field, but not by two, any ideas?
def list = {
params.max = Math.min( params.max ? params.max.toInteger() : 20, 100)
params.offset = params?.offset?.toInteger() ?: 0
params.sort = "raceDate"
...
I have
Entity A
- type
- uniqueKey
and
Entity B
- uniqueKey
and i dont know how to integrate it into hibernate that i can produce results like from this query:
select * from A
left join B on B.uniqueKey = A.uniqueKey and A.tpye = 1
where
A.id is null
this will produce a result that has all the entries of B that are not in A fo...
Dear ladies and sirs.
This must be a simple question. Given a criteria, how one deletes the entities satisfying the criteria?
The rationale:
HQL and NH criteria are NHibernate specific constructs and as such they are server side DAL implementation details. I do not want them to "leak" to the client side. So, our client side provides ...
i have a hibernate query that is dynamically put together using the criteria api.
it generates queries that are unbearably slow, if executed as-is.
but i have noted they are about 1000% faster if I prepend /*+ FIRST_ROWS(10) */ to the query. how can i do this with the criteria api?
i tried criteria.setComment(..), but this seems to be ...
Hello,
Here's the problem : I've got a huuge (well at my level) mysql database with technical products in it. I ve got something like 150k rows of products in my database plus 10 to 20 others tables with the same amount of rows. Each tables contains a lot of criteria. Some of the criteria are text values, some are decimal, some are just...
If there's any open source code that does this already I'm interested in hearing about it. But I haven't seen it yet so I'm trying to roll my own.
Example:
variable x = compareCriteriaBetween 3 and 6
variable y = compareCriteriaLesserThanOrEqual 5
The difficult part for me is finding an elegant way to compare the compareCriteria and ...
Using Castle ActiveRecord / NHibernate: Is there a way you can force an ICriterion on all queries on a table?
For example, a good amount of of my tables have a "UserId" column. I might want to ensure that I am always selecting rows for the logged in user. I can easily create an ICriterion object, but I am forced to supply it for differe...
Hello, I am basically trying to create this query with NHibernate ICriteria interface:
SomeTable 1:n AnotherTable
SomeTable has columns: PrimaryKey, NonAggregateColumn
AnotherTable has columns: PrimaryKey, ForeignKey, AnotherNonAggregate, YetAnotherNonAggregate
SELECT
table1.NonAggregateColumn,
subquery.SubQueryAggregate...
Hi, I was wondering if someone could help with an example criteria for nhibernate. I think I've got my head around fairly basic things, like finding records in a given table who's field matches a certain value etc. Where I'm currently tripping up is where you have a table with a foreign key for another table, and attempting to find rows ...