I've been trying unsuccessfully to filter a collection of child objects for a few hours how and have finally thrown my hands up! I'm new to NHibernate and was hoping for a couple of pointers on this. I've tried various ICriteria etc. with no luck. I'm just not getting it.
I have a parent object 'Post' with a collection of child objects ...
hi,
i'm using nHibernate 2.1.2 and relized that nhibernate will generate left outer join on nested many-to-one entities. it seems start generate left-outer-join on 3rd nested note onwards which start from entity Organization. i have set following in the mapping file to force use inner-join, has anything i missed out in the mapping file?...
Hi guys and girls.
Im using NHibernate to map my database tables with my entities and NHibernate Validator to validate my entities. It works sweet when validating the properties of the entities, however, is it possible to make database lookup validation with NHibernate Validator?
(Poor) Example: I have an Animal class and an AnimalType...
Object A has a one-to-many association: many object B.
When I look in the database -- TableB -- I'd like to see the unique, readable string A.Name instead of having always to join or subselect on a surrogate integer identifier to see the name.
I can map Name as the identifier for A, but this causes lots of extra SELECT queries because ...
NHibernate is working fine in my current solution but I would like to do queries that search all fields. How can I do something like
.CreateFullTextQuery<MyObjectGraph>("*", queryText)
.CreateFullTextQuery<MyObjectGraph>("%", queryText)
.CreateFullTextQuery<MyObjectGraph>("*:test")
.CreateFullTextQuery<MyObjectGraph>("%:test")
I tried...
HI Guys,
I'm working with an Oracle DB, and I'm trying to map this class:
public class Book
{
public virtual int Id { get; private set; }
public virtual string Author { get; set; }
public virtual string Title { get; set; }
public virtual string Text { get; set; }
}
With this mapping class:
public class BookMap : Class...
The query below makes use of ExecuteUpdate. I want said method to respect session filters. Is this possible?
//This line seems to make no effect.
_session.EnableFilter(FilterName).SetParameter(FilterParam, Value);
_session.CreateQuery(String.Format("DELETE FROM {0} WHERE Id IN (:idList)", object.Name))
.SetPar...
Lets say i have two entities;
QuestionAnswer(Id, AnswerValue)
Note(Id, QuestionAnswer_Id, NoteValue)
How would I map this in Fluent Nhibernate? I know that there is a HasOne mapping but this is for a 1 to 1 unless im mistaken?
I could also map it as a 1 to M but would require a List<Note> as a navigation property on my QuestionAnswer ...
Hello all,
Consider a transaction-per-view model where with an IHttpModule i open a transaction using a standard ISession.
Now, i have a page where i want to do some batch operations. Since IStatelessSession is preferred for batch operations:
Can i have both ISession and IStatelessSession open at the same time? Is it safe?
If 1. yes...
Hi,
im starting whit Nhibernate and have managed to get a few examples working, but now the aplication im makin throws this exeption when Nhibernate load the configuration.
NHibernate.MappingException: An association from the table TBL_MARCADAS refers to an unmapped class: Int32
at NHibernate.Cfg.Configuration.SecondPassCompileForeign...
I am using ISession.SaveOrUpdate to insert new objects and updaet existing.
If I use ISession.Save(..) this returns the identity of the inserted record.
For SaveOrUpdate I am doing the following:
public int Save(Vehicle entity) {
using (var txn = _session.BeginTransaction()) {
_session.SaveOrUpdate(entity);
...
I have a case where one of the columns on the database is generated using a trigger because of a specific way we generate this value which I can't change. If I in my mapping in NHibernate sets the property to generated=insert, it works like a charm, where NHibernate inserts the row without the generated property, and afterwards does a se...
I have a one-to-many relationship in data model from A to B. But in my domain API I do not expose "B"s on A (since we will never navigate from from A to B), but have a reference from B to A. Now I want to be able to delete all "B"s when A is deleted. Is it possible? Right now NH is trying first to set FK to null, which I don't want, and ...
Hello everybody
This is my problem.
I have a many-to-one relationship from a accountlist to a client
When i want to list accounts with client name, my HQL query ("From accountlist")
generates thousands SQL queries, one for the accountlist and one for each client.
Is it possible, with HQL to force to make juste one sql request with a j...
I have an entity which is constructed from a string and can be serialized to a string, e.g.
public class EntityPart {
public EntityPart(string str) {
// some construction logic
}
public override string ToString() {
// some serialization logic
}
}
and a domain object that contains a property of this t...
All my references are configured to be lazy loaded like this:
References(x => x.SomeProperty).ReadOnly().LazyLoad();
Everything works fine. Proxies are created. Now I added the following line in each entity mapping class:
Cache.ReadWrite();
and enabled L2 cache like this:
var fluentConfiguration = Fluently.Configure().Database(MsS...
Sorry if this question belongs somewhere else.
I am going through the source for NHibernate and there is a project called NHibernate.DomainModel with a bunch of seemingly useless classes.
What are those for? They don't appear to be used by NHibernate except for the other classes in that project and in the unit tests written for them...
I have an Class that is named Show one of the properties "Country" is a reference to another table.
Show Class
public class Show
{
public virtual int ID { get; set; }
public virtual Country CountryOrigin { get; set; }
public virtual string EnglishName { get; set; }
}
Country Class
public class Country
{
public virtua...
How can I map a nullable value-type property as a component in NHibernate?
For example:
public struct PersonName
{
public string FirstName { get; private set; }
public string LastName { get; private set; }
public PersonName(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;...
This is tightly related to a previous question I had. It's a row/column view where columns can be several different datatypes and each row might have a value for each column.
I thought of having the following structure
case
field
fieldType
bool_values
fieldId
caseId
value
int_values
fieldId
caseId
value
...