Ok, but how do I get it to look at the cache first? I don't want it to query the db until it can't find the object in cache, that would seem the natural order of things.
As far as the POID strategy I am using the db generated ID that increments by 1 each time a new item is added. JOsh On Wed, Jul 1, 2009 at 2:45 PM, Fabio Maulo <[email protected]> wrote: > Query mean always "query-to-db", after the query to DB is executed the > session-cache begin working returning you the existing instance in the > session-cache or attaching new instance.Btw because you are talking about > "conversation" we must know the POID strategy you are using. > > 2009/7/1 Josh Rogers <[email protected]> > > I don't know if cache is the right terminology, but it is the best I could >> think of. >> >> I am adding an object to a conversation by calling >> SessionFactory.GetCurrentSession().Save (which works), but later I need to >> retrieve that object but I do not know the id however I do know certain >> attributes of the object. So I created an ICriteria to look for those >> particular attributes, which works on its own for persisted objects. Now my >> problem is that when I have added the object to the cache but have not >> flushed it and I later call the attribute search function it never finds the >> object so it tries to create it again and then it crashes because it is >> already there. So the Save call sees the previously created entity as part >> of the conversation even if it has not been persisted to the DB however the >> CreateCriteria does not....this is not how I understood it to work, could >> someone please clarify? >> >> Thanks, >> Josh >> >> >> > > > -- > Fabio Maulo > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
