Do I have to close the ISession's that are generated by Castle's ISessionManager for NHibernate? How do I handle transactions with those ISession's? I'm still quite new to NHibernate.
Edit: I would like to have lazy loading but I get this message:
Initializing[failed to lazily
initialize a collection of role: , no
session or ses...
I have three classes that pose a problem when trying to add a new child.
They are:
User {
List attributesGroup>
}
AttributesGroup {
attributesGroupId
value
}
AttributesGroupId {
attrName
userId
}
The mapping is:
<class name="AlternativeUserAttributes" table="`AlternativeUserAttributes`" lazy="true"...
I am having a trouble mapping an embedded attribute of a class. I have created some classes that are similar to what I am trying to do to illustrate. Basically, I have an @Embeddable class hierarchy that uses Inheritance. The top level class "Part Number" has only one attribute, and the extending classes add no attributes to the "Part...
SQL Server doesn't support the "SELECT FOR UPDATE" syntax, which is used by NHibernate for pessimistic locking.
I read here on StackOverflow descriptions of other alternatives (I liked the "SELECT WITH (...)" because it's quite close).
however NHibernate doesn't seem to support this syntax.
do you have a workaround for this?
I believe ...
I am currently working on 100+ Java Objects created by someone with no JPA/Hibernate experience into JPA Entities. Their Objects reference other objects based on a Foreign Key in the Class itself. All of the primary Keys are generated outside of the database.
For Example (Just to Illustrate)
Car
@Entity
@Table(name="CAR")
public cla...
I've got two theoretical domain objects:
public class Person
{
public virtual int Id { get; private set; }
}
public class PersonMap : ClassMap<Person>
{
public PersonMap() { Id( x => x.Id ); }
}
public class DriversLicense
{
public virtual Person Person { get; set; }
public virtual string State { get; set; }
}
public ...
I need to get a collection property populated in a DTO and I'm having trouble finding any information on doing this.
I tried to do it like this:
ICriteria selectCriteria = Session.CreateCriteria<DataRun>()
.SetProjection(Projections.ProjectionList()
.Add(Projections.Property("SomeCollection"), "Collection"))...
I have two tables (Section and SectionList) that are related by a many to many table (Membership). Since there is an extra property in the many to many table, i have to break it out into its own entity:
public MembershipMap()
{
UseCompositeId()
.WithKeyReference(x => x.Section, "SectionId")
.WithKeyReference(x => x.SectionLis...
Is it okay to get a read-only collection from an aggregate without going through the root to get it? My model does some of this right now and I was wondering if that's an acceptable design. Thanks
Edit:
Here's an example
I have an aggregate root entity called UserAccount and another aggregate root called VideoStore. Users can have mu...
So I really like working with NHibernate but always used Spring.Net with it.
I recently came across StructureMap by Jeremy Miller and really like it better than Spring.Net. On his StructureMap site he promises an example on how to use NHibernate and StructureMap together. Unfortunately he has not had time to do it (or I can't find i...
I have the following code. In SQL Server profiler I can see the isnert statement being generated however no actual record has been inserted. I just can't figure out why this is happening!
private ISessionFactory _sessionFactory;
private Configuration _configuration;
_configuration = new Configuration();
_configuration.Configure();
_con...
I am a newbie in NHibernate.I am facing problem in mapping file.I have 2 tables Fetures and Priority.
Feature FeatureID(PK),FeatureName,PriorityID(FK)
Priorty PriorityID(PK),PriorityName
I want to bind a grid to Feature table but but grid should contain PriorityName rather than PriorityID.
I have tried one-to-one,many-to-one and ba...
Hi guys,
I need to implement a query form giving the user the opportunity to
build his own criterias,
based on selecting a property, an operator (=, <>, like, not like, in,
not in ...) and a value,
combining those with AND , OR logical operators. I wanted to store
there criterias in a separate
entity in my db.
Has anyone had this kind ...
As the title says, is it possible to get hands on the XML representation of a fluent nhibernate mapping? And if it is, can this be used directly with Hibernate for Java?
...
Hi,
Post Update: I have tracked down the problem at the command "ExecuteNonQuery". That's the one that fails during an update or hangs during an insert. Trying a simple example using plain ADO.NET and their transactions works perfect. Also... it works great on my local home computer connection an Oracle Express edition. Pointing it agai...
Hello,
I am looking to develop a website for a news channel.
So, Obviously its gonna receive a lot of hits daily and will be updated a lot on daily basis..
I have experience in ASP.Net and SQL Server..
These are the technologies i am considering to work with. Please help me choose the right method considering the amount of load it w...
We have been having this issue pop up sporadically, but now I can reproduce it every time. I am incrementing a view counter on my custom built forums, which causes an error:
NHibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed
This error occurs on another collection in ...
Consider the following simple C# class:
public class Entity
{
public Entity() { }
public virtual int Id { get; private set; }
public virtual DateTime DateCreated { get; private set; }
}
Mapped with the following simple NHibernate mapping:
<class name="Entity" mutable="false">
<id name="Id">
<generator class="n...
I have tried using the Reveal property in Fluent but I can't get it to compile with a collection. I want one of my collections in an entity to be protected and not accessible anywhere except in the entity itself. Is this possible? Thanks
Edit:
Here's the code I'm trying to use,
HasMany<Trip>(x => Reveal.Property<Trip>("_trips"));
I'...
Dear ladies and sirs.
I use NHibernate 2.1 beta2.
First the scenario:
My objects are divided into two parts - the stub and the stub complement. The idea is that when a collection of objects is required from the database, only the stubs are fetched. Once the user accesses a particular object and if the accessed field belongs to the stu...