Twitter blog claims a record of 6,939 tweets in 1 second - this was 4
seconds after midnight in Japan on New Year’s Day.
I decided to run a test, the steps to insert a row would be 3 selects
+ 1 insert (because of the data structure involved) - I managed 6900
in 578 seconds.
Obviously I am not ex
Does anyone here build their domain models using EA? I'd like to hear
your experiences please.
Thanks
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com.
To unsubscribe from this group, sen
> < unique key, such as Guid.Comb?>>
>
> No, not currently. It must be some sort of number because it's used in some
> queries (eg "<=", "max", "between").
Couldn't the datetime be used for that? Surely people think in terms
of Revisions and revision ranges, not revision numbers?
> <>
>
> Hmm.
>It's mandatory that the revision entity has a revision number and a revision
>timestamp. However, you can rename it to whatever you want though (both in
>domain model and in db schema).
Would it be possible to enable us to specify that this could be any
unique key, such as Guid.Comb?
Also, are
Is there a way to get NH to automatically set the single-end of an
association when inserting a child into a many end of a bi-directional
association? Or perhaps an extension?
e.g.
purchaseOrder1.Lines.Add(purchaseOrderLine1); would also set
purchaseOrderLine1.PurchaseOrder;
purchaseOrderLine1.P
Thanks, that's just what I needed :) However I don't like the idea of
throwing an exception because then you only get the first error rather
than a collection of all errors. Or will I have to implement
something myself?
> There is a not very known interface called NHibernate.Classic.IValidatabl
I've been reading through a page describing NHibernate Validator. I
was wondering how I would add a very class specific validation, as
creating an attribute seems to be the wrong way to write something so
specific. For example
Description: Start date cannot be before previous end date
Psuedo code
> You can download docs
> herehttp://sourceforge.net/projects/nhcontrib/files/NHibernate.Envers/
>
> There's a guy who has written a series of blog posts
> herehttp://www.primordialcode.com/blog/post/nhibernate-envers-quick-intro...
>
> There's plenty of information on the net, primarily for (Jav
That sounds excellent. Are there any example apps for this feature?
Pete
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com.
To unsubscribe from this group, send email to
nhusers+unsubscr.
Hi Roger
> NHibernate Envers might be what you're looking for. However - there the audit
> data will be put in seperate
> tables.https://bitbucket.org/RogerKratz/nhibernate.envers
An important part of the requirement is that I should be able to
retrieve an object at a given DateTime and browse
Another OPF I have used allows me to specify that a class is
versioned. When it is versioned you end up with two additional
columns in each relevant class - TimeStampStart, TimeStampEnd. When a
new row is inserted you get a TimeStampStart and a null TimeStampEnd.
When an object is modified the ex
I favour having an IExtentService instead - something like
public interface IExtentService
{
IEnumerable AllInstances(ISession session);
}
The *only* reason I have this is so that when I am writing tests and
need data from the DB I can instead mock the IExtentService and return
an in-memory Li
Ah, I see that all string comparisons in SQL Server are case
insensitive (not the query specifically). The last time I did SQL by
hand I was using InterBase which is case sensitive, so that didn't
even occur to me.
Thanks :-)
Pete
--~--~-~--~~~---~--~~
You recei
If that is the case, how would you perform a case sensitive
search? :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe f
Can I do a case insensitive string comparison using the current NH
Linq implementation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
T
Hi all
Any good visual studio integrated tools for creating my domain model +
mapping for NHibernate? Maybe some kind of UML tool or something?
Cheers
Pete
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers
Hi Greg
I have just tested a suggestion by Oren and it seems that it is in fact
possible to update an agg-root without modifying it. All you have to do to
mark it dirty is to update its version
public class Person
{
public Guid ID { get; set; }
public int Version { get; set; }
public string N
> However, for domain-only test-cases, mocked repositories might be better
> for
> testing, especially with a large number of database objects.
Don't say the "R" word :-)
Pete
http://mrpmorris.blogspot.com
http://www.AlterEgos.com - Who do you want to be?
--~--~-~--~~--
>>
Ok, then create and remove data in test setups. If you had touched the
database, then revert the modification in the test. otherwise they will be
slow.
<<
In CapableObjects I use a MemoryPersistenceMapper. It's basically a
thread-safe in-memory XML file for testing purposes. I don't have to
>>
Create the master structure once, fill data at TestFixtureSetUp and remove
them TestFixtureTearDown should eb nice enough
<<
Then tests can fail as the result of state left from a previous test. I
prefer to have a completely fresh environment for each test.
Pete
http://mrpmorris.blogs
> Sorry, I don't understand the question... Can you clarify further?
Here is the context:
http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx
Will creating the DB structure for each test take a long time when there are
200 tables.
Pete
--~--~-~--~~---
>>
The type can map to different types but instances will map to only a
single aggregate root.
<<
And the use case wouldn't know which the agg-root is?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" grou
> An instance of an entity always belongs only to a single aggregate root.
I thought earlier you had written something about OrderLine belonging to two
different kinds of order, one which was raising and one which was raised. I
can't find it now though so I may have been someone else. The pro
>>
While I am aware that we could sprinkle our locks around .. should we
have to? Can we avoid these types of hard to find copy/paste bugs by
allowing say a declaration that an object is an aggregate root?
<<
Take into account though that your logical region of validation differs
based on what
>>
Customer
Contact
Address
for the sake of discussion let's imagine that these are all entities ..
Customer c = CustomerRepo.Fetch(id);
c.Contact.Address.Street = "testing";
UnitOfWork.Commit();
<<
Your use-case knows why you are doing what you are doing. So it would load
+ loc
>>
with AOP the problem is finding the root (it might be 5 levels deep).
I was looking at Peter's suggestion but don't like what it requires. I
am currently looking at a way to do this only in proxies but the trick
is in finding out what aggregate root we are under while not having
the id carried
> I was hoping some people had some brilliant solution that had just alluded
> me :(
Could your solution be either to use Get with a lock mode
Session.Get(customer, LockMode.Write);
or if you already have the customer reference via a repository just to lock
it?
Session.Lock(customer, L
>
I see what you are saying build an interceptor ... then make my
root traversable from all thechildren .. have interceptor make the
session.Update call .. Is that correct?
<
It's the way I have done it in ECO (capableobjects), I make each part
implement IAggregatePart which has a GetRootOb
I wonder if this is the kind of thing that would do it?
//Mapping for your class here
//End of mapping for your class
This way it's a composite part of the aggregate root class?
Pete
http://mrpmorris.blogsp
Hi Greg
> how can I define child objects to use a parent's object versioning number?
>
> i.e.
>
> Student
>classes
>
> If there is a change to any class the student's version number changes
>
> The specific scenario is for a DDD aggregate.
I think the aggregate part wouldn't have a version.
I think the link to here
http://nhforge.org/doc/nh/en/index.html#manipulatingdata-interceptors
Is probably what I am after. I presume I only need to do a
UnityContainer.BuildUp(entity) in the OnLoad method. If so then that is the
rehydrate solved. My other problem is how to inject dependenci
> But you can use the alternative constructor.
Sorry Fabio, I don't know what you mean.
Pete
http://mrpmorris.blogspot.com
http://www.AlterEgos.com - Who do you want to be?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
> http://www.nhforge.org/doc/nh/en/index.html#persistent-classes-lifecycle ?
That wont do the trick. It is a callback mechanism for the entity instance,
what I need is a call back mechanism for the session so that I can inject
dependencies into the entity via an injection method.
Pete
h
Is there a hook somewhere in NH that gets called each time an object is
rehydrated? I want to call an InjectionMethod on each instead to inject
some dependencies, I don't need to use an alternative constructor, I just
need the hook :-)
Pete
http://mrpmorris.blogspot.com
http://www.Alter
Sorry, wrong group, obviously :-)
Pete
http://mrpmorris.blogspot.com
http://www.AlterEgos.com - Who do you want to be?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, se
[TestMethod]
public void Publish_LogsPublishedPlayerMessages_ForPlayer()
{
var mockActivityLoggingService =
MockRepository.GenerateMock();
mockActivityLoggingService.AddDetail("Hello");
}
Shouldn't this throw some kind of Unexpected exception? This test is
passing. I want to ens
"I realized that when lazy loading NH
does not touch the database before creating the proxy object. Now how
should NH know if it should create a ProfileA-proxy or a ProfileB-
proxy without checking the database for the discrimiator value? "
This is a big problem in my opinion. Surely NH could cr
>I mean, i have a service, i request an object, i don't know why i'm asking
> for it?
Correct.
> In general for a really complex system I build a DTO to send to the
> client,
Imagine the app manages the automatic payment of allowances on a period
basis. The client has just indicated that Em
> You don't know what you are giving your object for?
Well, firstly if I use a Repository pattern, no. I would want to write
public interface ICustomerRepository
{
Customer GetByID(int id);
}
and obviously wouldn't want
public interface ICustomerRepository
{
>B is not using projection, it is using a fetching strategy which will load
> it eagerly when needed and will leave the lazy loading if you are not
> going
> to request this data in the use case.
In a complex domain the number of possibilities could be so large that it
would be nearly impossibl
Let's say I have an object with an association to a single object and the
mapping doesn't specify that NH should fetch the associated object
automatically. Now when my app layer fetches that object and wants to do
some processing on it (which uses that association) I must either
A: Use proxie
>I wouldn't use container.Resolve
No I agree, I'd most likely have a SongBuilder injected into the class which
needs to create the song.
>>
Beyond all of that I would say that this is a great place where cqs
coud help
<<
Which I would like to see an example of :-)
>>
... are the varying h
>> Did you mean persistent or transient? I need a transient dependency to a
>> service.
>Not surprisingly I am using the definition of transient itself not
>refering to a transient vs persistent object. In other words for 95+%
>of cases the object does not need to *remember* which service to us
Hi Greg
>>
While you have done your very best to try to find and edge case
<<
I'm not actually looking for a corner case here I'm just trying to find a
way to implement what I currently need, but it does make me wonder about
injecting dependencies into my domain. Surely there are circumstance
Hi Anne
> Regarding your actual algorithm, it sounds like you're making
> something very similar to soundex.
Yes, it is basically that, for now at least. I will look at what algorithm
I will use when I am happy with the approach.
Pete
http://mrpmorris.blogspot.com
--~--~-~--~
Hi Fabio
> You can configure NH to use the field (including the backfield of an
> autoproperty) and don't have the setter.
Thanks, I am aware of that, the problem is an OOP one really. If I don't
have a setter then I wont be able to set the value without using a
parameterised constructor, and
>>
Haven't read the whole message (i will in a moment) but a quick answer would
be did you try NH Search, or pure lucene indexing?
<<
No, neither, but I am mainly interested in the conceptual part of the
question :-)
Thanks
Pete
http://mrpmorris.blogspot.com
--~--~-~--~~--
>
It is the thing that you last said, when exhaust a new Hi value is obtained,
Lo values are incremented everytime an object is persisted.
<
Ah I see, that makes sense. I am confusing it with the other approach where
only the exact number of IDs are requested when an update is required.
Pete
> and as for the people asking about what the behaviour was - the simplest
> thing is to setup a quick two-entity domain with hilo id, new one instance
> of each, session.Save them both and peek into the generated data.
As I am still at theory level and can't yet do that may I ask a question?
:-
> Fabio gives the answer but do you really need to do it?
Not sure :-)
I have a Song class which has a Name property. When the user searches for a
song I want to list songs with a similar name to what they entered rather
than the exact string. To achieve this I am considering doing somethin
> http://fabiomaulo.blogspot.com/2008/11/entities-behavior-injection.html
I think this link from your link will be more useful:
http://nhforge.org/doc/nh/en/index.html#manipulatingdata-interceptors
I can just execute
Container.BuildUp(entity.GetType(), entity);
That should do it.
Learning
Hi all
Sorry if this is a basic question :-)
If some of my business classes have dependency injection how do I ensure
that these dependencies get injected? I am assuming either
A: There is a hook somewhere that I can use for when NH creates rehydrated
instances.
B: There is a post create hoo
> No problem, but a real functional example would be better for NH's users,
> believe me.
I'll see what I can do.
Pete
http://mrpmorris.blogspot.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"nhusers
Hi Fabio
> Interesting.Do you have a public example ?
I'm a complete newbie with NH so no :-)
The implementation though would be something like
var mainContainer = new UnityContainer();
//Registration of new feature
mainContainer.AddNewExtension();
//Register repositories etc from some confi
I have finally tried the code in this post
http://unity.codeplex.com/Thread/View.aspx?ThreadId=46415
It works great for specifying services which rely on a context that is not
defined until a child container is created. Now I can easily have a
UnitOfWork for unique contexts without having to w
I've gone with this...
01: Direct access to the field on the parent
02: A ReadOnlyList for accessing the children
private ISet comments = null;
public ReadOnlyCollection Comments
{
get { return new
Here is the SQL generated:
SELECT TOP 1 ID1_0_, Title1_0_, Body1_0_, PostedOn1_0_ FROM (SELECT
ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.ID1_0_,
query.Title1_0_, query.Body1_0_, query.PostedOn1_0_,
query.__hibernate_sort_expr_0__ FROM (SELECT this_.ID as ID1_0_, this_
Hi all
I've recently started to evaluate NHibernate and have a question regarding
implementation of one-many associations. Let's say we have
[ParentClass] Parent 1* Children [ChildClass]
It seems to me that when considering an in-memory model only I would do
something like this
ParentCl
> http://groups.google.com/group/nhusers/browse_thread/thread/ac5979588ef67755
I'd have stuck with a single-value for the attribute, and introduced a
sub-node which may repeat for this so that the user can specify multiple
Pete
http://mrpmorris.blogspot.com
--~--~-~--~~--
Hi all
Not sure if this is off-topic or what :-)
When I create a repository interface it looks a bit like this
public interface BlogEntryRepository
{
BlogEntry GetByID(ISession session, int id);
}
I am a bit suspicious of the "ISession" parameter. I suspect it shouldn't
b
>>
Doesn't NHibernate do some kind lock to do a version check (locking
update on that object for the time of the DB transaction, SELECT FOR
UPDATE) ?
<<
Version numbers are for checking conflicts on the *same* object, they can't
be 100% reliable for checking conflicts on objects you are not upd
>>
I'm assuming that NHibernate does the version check at commit/flsh
time. In other words NHibernate commits all data and version ckecks in
a single database transaction.
If that is not the case, this doesn't work!
<<
Even if it *is* the case, without some kind of update-lock it still wont
work
Hi Nuno
> Usually once you dispatch something the date is locked
But that would just be changing the question to make the answer easier :-)
The example isn't meant to be realistic, just simple :-)
> NHIbernate (or any other system that cares for it). In the case of
> NHibernate it will lock
Dispatch.Date = Today - 1
Delivery.Date = Today + 1
Dispatch.Date must be <= Delivery.Date
Delivery.Date must be >= Dispatch.Date
User 1: Fetch Delivery
User 2: Fetch Dispatch
User 1: Update Delivery.Date - 2 days
User 2: Update Dispatch.Date + 2 days
User 1: Check constraint, it's valid, save.
> It seams that we can set the proxy factory to be used by NHibernate:
> proxyfactory.factory_class in the config file. Basically the it would
> intercept a call to the method, check if that method was a business
> rule, if that was the case it would lock the object. Locking the
> object will forc
Hi James
> You should also bare in mind that you're very early on in the book.
> Perhaps
> the example could've been structured better, but you're still only on the
> 2nd chapter; you can't expect everything to have been explained already
> otherwise you'd be at the end of the book.
Obviously
> To elaborate a little on what Ken said. HQL is the Hibernate Query
> Language,
> which means you're querying NHibernate rather than your database. It
> probably should have been mentioned in the book, but this means that your
> queries are case sensitive for entities (keywords are insensitive);
> just remember - HQL (and criteria API) are about OBJECTs not Database
> fields.
> and please do take notice to the error messages. They tend to be very
> informative - the use of 'property' should have raised the red flag for
> you.
I spotted the word property, and if it had been "firstName" o
Ken.
Yes, you are correct, thank you very much! I would never have suspected
case sensitivity!
Pete
http://mrpmorris.blogspot.com
http://www.capableobjects.com - Think domain, not database
--~--~-~--~~~---~--~~
You received this message because you are s
n the book and this
one is not addressed later, so if someone can explain this to me I'd
appreciate it.
Thanks
Pete
http://mrpmorris.blogspot.com
http://www.capableobjects.com - Think domain, not database
>
> On Sun, Feb 15, 2009 at 1:12 PM, Peter Morris wrote:
>
>>
> Are you referring to "Hello World" with NHibernate? Because if you are,
> there are more steps after the one you're talking about. 2.1.5 creates the
> code to save, then it carry's on explaining things until you get to 2.1.8
> where you actually configure your application.
Yes I am, and I am al
The book simply says this
01: Create a console app
02: Add an Employee class
public class Employee
{
public int ID;
public string Name;
public Employee Manager;
public string SayHello()
{
return string.Format(
"'Hello World!', said {0}.", Name);
}
}
03: Create the DB
04: R
Hi Tuna
Yes. I downloaded 2.0.1 from the website.
>>
I guess you are using 2.0 versions and it doesn't have "hibernate.dialect"
thing. New versions use "dialect" only.
<<
Could you tell me what is wrong with the code example I posted so that I can
fix it? This is my first exposure to NHibern
Hi all. I'm working through the first example in "NHibernate in
Action" and guess what? It doesn't work!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using ConsoleApplication30.Model;
namespace ConsoleApplication3
74 matches
Mail list logo