Hey,
All this works. BUT only if the lookup has not already been loaded into
session.
If it is loaded and I'm trying to use the static value it fails with
NonUniqueObjectException.
So before setting the value to the object I have to Evict it first:
session.Evict(address.Country)
address.Country
How a database should be designed so that it should work best with NH.
Are there any best practices for the same.
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
nhusers group.
To post to this group, send
Hi Sachin,
Don't. We've been bitten by this several times. NH is powerful when you
start with your domain and make the DB just an afterthought. Just optimize
the DB near the end of the project.
Thanks,
Robert
On Fri, Jul 31, 2009 at 3:18 PM, Sachin sachingupta1...@gmail.com wrote:
How a
I am having trouble getting NHibernate 2.1 to work with Oracle Client
10g.
I am getting Unable to cast object of type
'Oracle.DataAccess.Client.OracleConnection' to type
'System.Data.Common.DbConnection'.
See
Hi All-
I'm using the NHibernate.Caches.Velocity provider with Microsoft
Velocity CTP3. The current implementation uses cache regions (because
the ICacheProvider.BuildCache takes in a region name as one if it's
params, and because you're only able to clear an entire group of
objects in Velocity
Hello,
Just getting started with NH and have run into a hitch with a query
I'm trying to create via the ICriteria approach. I'm certain that this
is a fairly simple thing and the reference docs seem to get me close,
but here's an example-
Given two tables, Products and Categories, where each
i have got this sudden problem with my new projects that i cant insert
in my database. i do as i always do but now for some reason it wont
work. what possible reasons can this be?
i got a project with the same setup that works great on this
computer..
let me know what kinda info you would like
Hallo,
I have the following class structure:
class Parent{
long Id{get;set;}
IListChild Children{get;set}
}
class Child{
long Id{get;set;}
}
If I'm doing somthing like this:
var parent = new Parent();
parent.Children.Add(new Child());
session.Save(parent);
session.Flush();
It
Hi Jeff,
If you want to return a ListCategory(), then I suspect you want to use
CreateAlias() instead of CreateCriteria(), however I suspect judging from
the projection in your SQL query you actually want some custom
object/projection returned.
If you want to restrict the products to a
Exactly. They are both.
These are from my domain model. And i want to use as data transfer
objects for screen display.
I want them to be as light as possible. That s why i want all my
fields to be either string or int.
Can i do the projections in the xml mapping instead of doing them in
the c#
You need to make sure that the session flushes automatically and not only on
commit.
-Markus
2009/7/30 Niclas Pehrsson pehrs...@gmail.com
Yeah I need cascade the saving of employee on my company to be able to
save the employee and company in the same transaction, I was looking
for another
Errors? Code samples? Entities? Mappings? Show us something.
On Thu, Jul 30, 2009 at 7:42 PM, Topflysecurity konnektgra...@gmail.comwrote:
i have got this sudden problem with my new projects that i cant insert
in my database. i do as i always do but now for some reason it wont
work. what
Hopefully the formatting of the query will be correct this time:
var categoryDetails =
s.CreateCriteria(typeof(Product))
.Add(Expression.Lt(UnitPrice, 40))
.Add(Expression.In(Id, myProductList.Select(p = p.Id).ToArray()))
.CreateAlias(Category, categoryAlias)
The DbConnection is needed for schema. Try to disable all
schema interactions.
http://fabiomaulo.blogspot.com/2009/06/auto-quote-tablecolumn-names.html
2009/7/30 JohnRudolfLewis johnrle...@gmail.com
I am having trouble getting NHibernate 2.1 to work with Oracle Client
10g.
I am getting
Good day!
many-to-one is what I would do if I have a customer with many addresses, but
what if there is only one address per customer?
Thanks.
On Mon, Jul 27, 2009 at 9:34 PM, James Gregory jagregory@gmail.comwrote:
Sounds like you want to have a
Hi,
I think, I understand DistinctRootEntityResultTransformer and I know
its implementation.
Let me summarize:
RepositoryDbProduct.FindAll(
DetachedCriteria.ForDbProduct().
SetFetchMode(Categories, FetchMode.Eager));
In above case
Looked like a bug to me.
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Fri, Jul 31, 2009 at 2:41 PM, Saijado saij...@googlemail.com wrote:
I have this class-structure:
class Parent{
Maybe this weekend I will try to specify a test for Jira
2009/7/31 Tuna Toksoz tehl...@gmail.com
Looked like a bug to me.
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Fri, Jul 31, 2009
A little supplement.
This is more generic problem and I hope you not to tell me 'it is by
design'.
When in DB you have Product P, which has two collections: Categories
{C1} and Attributes {Att1, Att2, Att3}
and you try to read it from DB:
RepositoryDbProduct.FindFirst(
Hello Richard,
Thanks for getting back to me... much appreciated. Since I'm new to
NH, there's a lot in your code that's new to me (particularly the
whole Projections concept)... so I'll do some Googling around and
mining through the docs to try to make sense of it.
In the meantime, in your
2009/7/31 Jose Samonte jose.samo...@gmail.com
Good day!
many-to-one is what I would do if I have a customer with many addresses,
but what if there is only one address per customer?
you can have a many-to-one for persistence matters (for NH) and a ono-to-one
for domain matters.
The one-to-one
Your is only part of the story... now try to study de difference between the
semantic of a Bag and the semantic of Set.
2009/7/31 Bartosz Pierzchlewicz bar...@extranet.one.pl
A little supplement.
This is more generic problem and I hope you not to tell me 'it is by
design'.
When in DB you
I was doing a migrate from nhibernate 1.2 to 2.1(quite the migrate!!)
and it looks like for the relationship tables it used to store the
assembly qualified class name for many to any relationships but now it
looks like it just stores the class name and not the assembly. Is this
true? if so is
Hi Jeff,
The projection is required if you need the results to be distinct.
Unfortunately, it would appear when you project onto an entity using
Projections.Distinct, then NH just returns the identity (rather than the
whole object).
my thinking was to return a ListCategory(), though I'm
Sorry, the CreateCriteria() vs. CreateAlias() doesn't change the returned
type, the second example should have been:
session.CreateCriteria(typeof(Product))
.CreateCriteria(Category) // note this is the property name on
Product, not the type
.ListProduct();
(i.e., still returns
Hello,
I need to do a query that returns the top n items from a table.
e.g
select top 10 * from table
the problem is that I need it to work in mssql and oracle, is there
any form
to do that with nhibernate abstraction??
p.s The table is very large, so I cannot retrieve all and truncate in
.SetMaxResult(10)
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Sat, Aug 1, 2009 at 12:20 AM, spiralni the.email.tr...@gmail.com wrote:
abstraction
Ok thanks,
Can I use it with HQL??
Will this extract the n items from database or just retrieve all and
truncate them in memory??
- Original Message -
From: Tuna Toksoz
To: nhusers@googlegroups.com
Sent: Friday, July 31, 2009 3:25 PM
Subject: [nhusers] Re: Select top n
.CreateQuery(from Entity e).SetMaxResults(10)
filter them in database not in memory.
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Sat, Aug 1, 2009 at 12:31 AM, Cesar Sanz
Ok, many thanks!!
- Original Message -
From: Tuna Toksoz
To: nhusers@googlegroups.com
Sent: Friday, July 31, 2009 3:44 PM
Subject: [nhusers] Re: Select top n (MSSQL, ORACLE)
.CreateQuery(from Entity e).SetMaxResults(10)
filter them in database not in memory.
Tuna
For those of you doing DDD with NHibernate...
Is it pretty typical to run into scenarios where the way your value objects
are used with the domain requires a class mapping with its attendant id
requirement? I guess what I'm asking is whether having to support an ID
within my value object for the
Hi, Richard...
Wow - lots to get my head around here. I appreciate your help and will
start going through those examples and pointers line by line so I can
grok the various options/approaches.
Thanks again!
On Jul 31, 2:04 pm, Richard Brown \(gmail\)
fluke...@googlemail.com wrote:
Hi Jeff,
In DDD, ValueObject is more of a conceptual understanding of an object
and how it is meaningful in the system. You probably already know
that, but I wouldn't be so concerned about introducing an ID into your
ValueObject to try to keep your objects 'cruftless'. You haven't
violated any DDD
Hello pals,
I am starting with Fluent for NHibernate, I have used ActiveRecord
with previous projects, but
to tell the truth I do not like to decorate my model with tags,
neither I like to write and maintain so many
xml files (as the project grows, it get harder)
So my question is simple,
Is
Thanks for the feedback Mike!
I'm still feeling my way along with DDD...and NHibernate. I'm a big
believer in the pragmatic compromise but it isn't always easy to tell
whether a particular path represents a pragmatic compromise or an ignorant
one.
...And nice transformation of the 'cruft' root.
In NH you can have an entity without the ID and the ID only for persistence
(without a private filed).In uNhAddIns or in my blog you can find
various examples the last is:
Entity:
public class UserMitaMita
{
public virtual string Name { get; set; }
public virtual Country Country { get; set; }
}
FNH is serious way to mapping your entities and not serious alternative to
abstract NHibernate.
Perhaps FNH does not do all you can do using mappings but you should change
your mind from map any specific to map by convention.
2009/7/31 spiralni the.email.tr...@gmail.com
Hello pals,
I am
37 matches
Mail list logo