I'm having a lot of trouble cascading deletes through a HasAndBelongsToMany relationship using Castle ActiveRecord/NHibernate.
I have Photos which have and belong to many Tags. They are joined by a table called PhotoHasTag which just has a photoId and tagId. When I delete a Photo, I'd like all associated PhotoHasTag entries to be delete...
I have a scenario which is not easy to explain, but I am sure it is a very common problem. I will try my best to illustrate the problem.
Lets say we have a Survey application which allows us to create surveys. Each survey has its own structure (contains questions, questions are grouped and ordered, etc.). Those surveys are managed by an...
Hi,
I am using linq to Nhibernate to fire some select query to data base.
My question is, how do I know, the query generated by Fluent NHibernate?
...
Essentially the title of this question explains the essense of what I am trying to do, but to create a contrived example...
I have a class, call it Employee. Employee has an IPaymentBehaviour...
public class Employee
{
IPaymentBehaviour _paymentBehaviour;
protected internal Employee() { /* required by NH */}
public Employee(IP...
Hey,
I have populated a MySQL table with utf-8 strings (using a python script).
You can assume that the string in the DB was correctly encoded (I've verified this by extracting the string from MySQL Query Browser and running a utf-8 decode... got my original unicode string).
Now the problem begins when I try to load this string using N...
Hi,
I am using fluent nhibernate.
example:
i have 3 tables i.e.
CUSTOMER
CustomerId pk
CustomerName
PRODUCT
ProductId pk
ProductName
Cust_Product
cust_prodId pk
ProductId fk
CustomerId fk
Now, I want to show customername, productnae
so, how do i write mapping class for the same.
i want to use
session.CreateCriteria(typeo...
Strings are unbounded, but it seems every normal relational database requires that a column declare its maximum length. This seems to be a rather significant discrepancy and I'm curious how typical ORMs handle this.
Using a 'text' column type would theoretically give you much more string-like storage, but as I understand it text columns...
Is it possible to perform a left join between two tables that are not related each other through a parent-child or many-to-many relationship ?. All the samples I found around only show those scenarios.
I have the following tables,
Sync
-> Id (string)
-> EntityId (string)
-> OtherInfo
Customer
-> Id
-> OtherInfo
Project
...
I know that you can generate a database from classes and their mappings using nHibernate, but I can't find any good links to do this the other way around. We have a database that has already been designed, and we are looking at using nHibernate. It would be nice to use a tool to generate the mappings and classes from the database, and ...
I have an Asp.Net MVC application that works in the vs.net development web server. When I publish to IIS7 I get the following error. I have spent many hours and still no solution!
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineStepManager.ResumeSteps(Exception error) +929
System...
So I'm trying to update an object in my MS SQL 2005 database using NHibernate. Please keep in mind that this is a legacy database used in many live systems and I can't remove the triggers.
When my data provider tries to .SaveOrUpdate() a row I get two returns (one for the actual update, and one when the trigger executes)
The raw retur...
I have situation where a Message table has a primary key (Id) and a foreign key (Site). Any site can create a message record, but only the site that created the record can update it. The problem is that by default it will be updated based upon Id and not Id and Site. I could change the primary key to be a composite/compound id consist...
I have just started a new project using nHibernate and Fluent for mapping. The architect has sent me a database from which I have generated several hundred entity classes and the corresponding Fluent mapping files. I know this is not the ideal DDD way of doing things but life is rarely ideal.
What I want to do is test that all the mappi...
Hi,
I am using Fluent NHibernate,
I have writen following code to select Customer Name and CustProdId.
when i execute code, i got error, "Method Join is not implimented."
How to write inner join for this query?
var data = (from cp in session.Linq<CustomerProduct>()
join cu in session.Linq...
I'm trying to save a mapped entity using NHibernate but my insert to the database fails because the underlying table has a column that does not allow nulls and IS NOT mapped in my domain object. The reason it isn't mapped is because the column in question supports a legacy application and has no relevance to my application - so I'd like ...
OUR PROBLEM:
If the user which sould be notified is in the requested List ("users")
it's Address Association is initialized with the query provided above.
If we call the NotifyUser-Method the Address Association should be initalized
with all Addresses of the user, but in this case the Address-Association
is cached, and we only get the A...
I have a class Contact (base class),a class called Customer and a class called Supplier. Customer and supplier class both derive from Contact.
Customer has a 0..n relation with Order. I want to have a Collection property on customer and have it mapped in NHibernate to its corresponding table.
How is this done in NHibernate (version 2....
I'm using Fluent NHibernate in order to auto map my entities.
This is the code I'm using for the auto mapping:
new AutoPersistenceModel()
.AddEntityAssembly(Assembly.GetAssembly(typeof(Entity)))
.Where(type => type.Namespace.Contains("Domain") && type.BaseType != null && type.BaseType.Name.StartsWith("DomainEntity") && type.BaseTyp...
Hi,
I have the following scenario in nHibernate (sorry for the screwed up XML, but the text editor was "helping me"a little too much while I was trying to copy it in ;-))
<class name="TestApp.Components.User,TestApp.Components" table="Users">
<id name="Id" column="UserId" type="Int32" unsaved-value="0">
<generator class="native">...
Hi all, I'm pretty much a newbie and I need to dig into this matter to write some college article so I need some bootstrap.
Here and there I read that NHibernate offers much more flexibility (compared with L2S) in mapping domain model to database. Can you write down some hints what should I explore?
...