Hi all
I have a web page which uses NHibernate to load a domain object. The object's state is then stored in the page controls, and when the user clicks the save button, a new object is created and its properties (included the Id) are populated from the page controls. I then call session.Save() on the object.
This to me means that NHib...
I have a product table that has a many-to-many relation to itself (using a two-column many-to-many table) and I have set it up in Fluent NHibernate with the following code:
public class ProductConfiguration : ClassMap<Product>
{
public ProductConfiguration()
{
Table("Product");
Id(p => p.Id).GeneratedBy.Guid();
...
Hello,
Currently I am using many-to-one element in hbm file to fetch the data object from database like following....
<property name="ContactId" length="4" />
<many-to-one
name="DefaultContact"
column="ContactId"
class="Models.Contact"
update="false"
insert="false"/>
This code is fetching the data properly, but no...
Hi all
On my dev web app NHibernate is working just dandy. When I precompile and deploy the site, I get a MappingException when the SessionFactory is created.
Here's some info from the trace:
NHibernate.Cfg.Environment 2010-07-15 09:20:59,577 [7] INFO NHibernate.Cfg.Environment [(null)] - NHibernate 2.1.2.4000 (2.1.2.4000)
0.452...
Each user has a list of roles:
<class name="User" lazy="false" table="Users">
<id name="Id" type="int">
<generator class="native"/>
</id>
<property name="Name" />
<bag name="RoleList" table="User_Role" inverse="true" lazy="false" collection-type="Roles">
<key column="UserId" foreign-key="Id"/>
<many...
I have Product and Category tables in database.
One product can have many categories.
One category can have many products.
So, I have a third table as ProductCategory, which has ProductID and CategoryID.
In Fluent NHibernate, what does the mapping class should look like?
For example, For ProductMap class is it correct:
HasMany(x =>...
Hi all
I have a data access class with an Enum called Salutation:
public enum Salutation
{
Unknown = 0,
Dame = 1,
etc
Mr = 5,
etc
}
I am peristing the class with NHibernate, and up until this morning I was using .hbm.xml files for mapping. However, I've now switched to using Fluent NHibernate, but loading ins...
Hello, gentlemen! First, I've tried to ask the similar question yesterday (http://stackoverflow.com/questions/3255407/nhibernate-many-to-many-relationship-question-can-select-cant-update), but after a debugging night hopefully I can rephrase a question the better (right?) way. If I am doing something wrong by that - please tell - I'll er...
I have a simple object model of a header with multiple detail lines. I have mapped a bag property on the header object to the line class and also put a header property on the line class to set the two way relationship.
When I run my tests, using NHibernate Profiler I can see that the query is being performed, and the header and lines ar...
I have this nhibernate query:
var q =
NHibernateSession.Current.CreateSQLQuery
(
@"SELECT LastestEvents.*
FROM (
SELECT DISTINCT SbQcontainer.Container
FROM HistoricEvents
SbQc...
I have a use-case in my app where I need the first two levels of my object tree.
I have an object called Player which has a list called CheckIns
that holds a many-to-one connection to Player as an object reference
when I execute the Query I get back a seemingly endless chain of
Player->CheckIns->Player->CheckIns and so on..
What I nee...
I need to persist this class on database using Fluent NHibernate:
public class RaccoonCity
{
public virtual int Id { get; private set; }
public virtual DateTime InfectionStart { get; private set; }
private IList<Zombie> _zombies = new List<Zombie>();
public virtual IEnumerable<Zombie> Zombies
{
get { retu...
Consider the following scenario:
Class A has a one-to-many relationship to Class B.
Class B has a many-to-one relationship to Class C.
class A {
IList<B> BList {get;set;}
}
class B {
C CMember{get;set;}
}
class C {
//null
}
If I load class B from the database using something like
IList<B> result = query.List<B>();
every...
Is this possible without mapping the join table to a domain entity?
For example if I have the following three tables, account and note are joined by the table account_note. Can i map a collection of notes to account class with a one to many mapping?
1 to M | 1 to M
Account -> Account_Note -> Note
...
I have a hierarchical structure like this:
class Node
{
Node Parent;
string Name;
string Code;
}
and I need to reflect in nhibernate mapping files that the combinations (Parent, Name) and (Parent, Code) BOTH are unique (even when Parent is null). Does nhibernate allows multiple unique-key on the same field? Something in the like...
Hi friends! I'd like to know, How Could I map (with fluent nhibernate) this model:
public class Category
{
private IList<Product> _products;
public IEnumerable<Product> Products {
get { return _products; }
}
/* others properties */
public Category() {
_products = new List<Product>();
}
// to add...
I have the following entities.
class Parent
{
public virtual int ID {get; set;}
public virtual string Key {get; set;}
public virtual string Type {get; set;}
public virtual string Value {get; set;}
public virtual IList<Child> Children {get; set;}
}
class Child
{
public virtual int ID {get; set;}
public virtual string Paren...
Earlier I asked this question: http://stackoverflow.com/questions/3339477/loop-in-mysql-or-alternative/3339494#3339494
I got a great answer and it does work. Now in my application I am using NHibernate(in C# .NET 3.5) as the DAL. I dont really know how to deal with multiple return types, so I tried the following:
var session = NHibe...
hello i have an error when i execute a request with hibernate
ERROR ast.ErrorCounter (ErrorCounter.java:33) - line 1:22: expecting IDENT, found '*'
my dao:
public List rechercheValeurTarifs() throws Exception {
List tarifs = null;
try{
tarifs = getHibernateTemplate().find("SELECT FE_TARIF_IDF.* " +
...
I'm looking for some suggestion.
We have server setup as below for 3 applications interacting together.
1) Application A with Database A
2) Application B with Database B
3) Application C with Database C
Use Case: User's from application A submits some requests which is then sent to application B or C for approval. User's from applicat...