public MyClass(int someUniqueID)
{
using(//Session logic)
{
var databaseVersionOfMyClass = session.CreateCriteria(/*criteria*/)
.UniqueResult<MyClass>();
//Load logic
}
}
The code sample above is my current direction, although I've reached a point where I need a bit of a sanity check.
With NHibernate(I'm gree...
Hi,
I need help with an nhibernate query. I would prefer to use Criteria API if possible, otherwise HQL is ok.
I have an Employee object with an Account object property, the Account has a collection of Entry objects, and each Entry has an Amount property. (see class diagram).
http://www.threeboxes.com.au/employeeQuery1.jpg
I need a q...
Hi I'm testing some CRUD operations in Nhibernate.
I have 3 tests in this order - add
update and delete.
When I test the update procedure I always get a fail as the object I just added is null.
Do I need to close the session or do a flush before doing the update test. Or is there a better way for me to do this.
Any help more than appre...
In NHibernate, Is it possible to do a look up based on an entity passed?
I would like to pass an object from the ui and do a look up based on its values instead of having multiple methods for each possible variation.
For example if I pass a user with the firstname 'John', I'd like to return all users with that firstname.
Any hints muc...
I am going nuts here trying to resolve a cascading update/delete issue :-)
I have a Parent Entity with a collection Child Entities. If I modify the list of Child entities in a detached Parent object, adding, deleting etc - I am not seeing the updates cascaded correctly to the Child collection.
Mapping Files:
<hibernate-mapping xmlns...
Hi, I'm using an EnumStringType in my mapping to insert the enum string value in my DB.
The problem is that Oracle needs AnsiString type for their parameters, and the EnumStringType maps the parameter values to "normal" String types. Something that got me busy for days until I found this article of James Kovacs
Which means, that currentl...
Hello, I have a problem mapping an Id. The structures of the entities are as follows:
public abstract class Entity<TEntity, TId>
where TEntity : Entity<TEntity, TId>
{
public virtual TId Id { get; protected set; }
public override bool Equals(object obj)...
...
}
public class EntityA<EntityA, long> : Entity<EntityA, long...
I'm using NHibernate with SQL Server 2005.
SQL rejects my Schema because I have an unquoted column name "User" which was auto generate from the property of my domain object.
<class name="Entity" table="Entities" lazy="false">
<id name="Id" />
<property name="User"/>
<property name="Domain"/>
<property name="Password"/...
I am trying to get started working with NHibernate. I went to download the latest production release at https://www.hibernate.org/6.html. The NHibernate download says development beside it, whereas other downloads say Production.
Is this what I want?
...
Hi,
I'm searching for a distributed caching solution on mono similar to java's terracotta and infinispan. I want to use it as a level 2 cache for nhibernate. Velocity and sharedcache have no mono support, and memcached isn't distributed nor have high availability.
Best Regards,
sirmak
...
I compiled the fluent nhibernate 1.0 rc with nhibernate 2.1 and had several warnings after the errors were fixed.
Fluent nhibernate tells me to use a separate Subclass-map instead of JoinedSubclass.
Current Mapping:
public class ClientMap : ClassMap<Client>
{
public ClientMap()
{
LazyLoad();
Id(x => x.Id);
...
I've either misunderstood the NHibernate manual or I've done something wrong. Can anyone help?
I am trying to retrieve a User without the AuditLogEntrys.
But NHibernate is still loading the AuditLogEntrys. I only want the AuditLogEntrys loaded when I access the property.
public class User
{
public virtual int UserId { get; set; }
...
At the company that I work with, we often have to integrate with client’s infrastructure.
Recently, after hearing that we use Hibernate, one client manifested following concern: Since user under which Hibernate connects to database has a direct access to tables and Hibernate generates SQL dynamically, then such user can do pretty mach an...
I understand how NHibernate separates the persistent db structure from the logic and how the mapping works, but how do you guys handle data intensive actions, complex select scenarios, data maintenance, etc? We use stored procedures for things like these and we actually have quite a few of them.
Now what is the recommended practice? Is ...
I seem to be having a problem with checking for list equality. In my case, I have two role objects and I want to see if they are equal. Each role contains a name and a List of permissions. Each permission contains just a name.
public class Role : BaseDomain
{
virtual public String Name { get; set; }
virtual public IList...
How a can verify if a field of a child is null or empty when verifying the parent object?
Example:
public class Zone {
[NotNullNotEmpty(Message = "Zone name is required.")]
public string Name;
public Foo Foo;
}
public class Foo {
[NotNullNotEmpty(Message = "Foo bar is required.")]
public string Bar;
}
...
Using the method described in NHibernate & INotifyPropertyChanged, the repository will return a collection of proxies that implement INotifyPropertyChanged, but on some objects when saving or deleting it will throw an error:
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
at NHibernate.Impl.SessionImpl....
0 vote down
Hi,
I am running with same Issue of at the time of Commit transaction it fails. I have changed my all mapping string with AnsiString. But still i am getting error.
Select is working fine, even delete is also working fine.
If my transaction contains only one insert statement or update statement then also it is working fin...
I am using NHibernate/Fluent NHibernate in an ASP.NET MVC app with a MySQL database. I am working on an operation that reads quite a bit of data (relative to how much is inserted), processes it, and ends up inserting (currently) about 50 records. I have one ISession per request which is created/destroyed in the begin/end request event ha...
Hey all. Quick question on Fluent syntax. I had thought I had this down, but I'm getting a weird failure. Basically, I have a hierarchical kind of structure that I'm trying to persist, and it all seems to work, except when I do an actual integration test w/ the db.
I have a Node object which has a Parent property, which is another Nod...