[nhusers] Re: Nhibernate Search, index on collection items

2009-05-26 Thread Jea
Ive now found out that Nhibernate does not trigger OnPostUpdate if only items in the collection has been updated (and not the main object). Ive fixed this so i automaticlly sets a date on MyObject (needed it for the domain anyway so its no big deal). But there stills no info about MyOtherObjects.N

[nhusers] Nhibernate Search, index on collection items

2009-05-26 Thread Jea
I can’t seem to find a solution on a problem I have with Nhibernate Search and Lucene. Basically I want to be able to search a collection (many-to-many) on an object, but the collection does not seem to get indexed. I’ve checked with Luke. I’m only interested in doing searches on MyObject, but al

[nhusers] dynamic parameter values in sql-delete statement

2009-05-26 Thread sravan
Hi All, I have a requirement where when i do a delete i should not hard delete, instead just update the Status of the record and based on some mode i have to create a new record too. so i have stored procedure that takes the id of the entity to be deleted, table name and mode and in sql-delete

[nhusers] Re: Difficult DBA

2009-05-26 Thread Fabio Maulo
If I well remember I have something in my own TODO list of generators (rollback identifiers).There is something similar using Table-based-id generator. Btw that generator is not so hard to implements even is I don't like full-server-side generator ID. The only one full server side I like is sequenc

[nhusers] Re: Difficult DBA

2009-05-26 Thread allan.ritc...@gmail.com
Increment isn't safe to use for multiple app domains. HiLo is ultimate all-round IMO. I can do batch inserts from NH and they don't collide across appdomains. I usually set the max_lo to 500 as I've found that to be ideal and it makes the gaps small though I don't consider the gaps an issue. T

[nhusers] Re: Difficult DBA

2009-05-26 Thread Tuna Toksoz
This is almost exactly what NH Increment generator does, hilo takes it further. BTW, you can set capacity (maxLo) for HiLo generator, if that makes your dba happy, this will have even less gaps. Why do those DBAs are careful about it? You have quantillions(10^18) of IDs when using long! Tuna Tok

[nhusers] Re: Difficult DBA

2009-05-26 Thread Bill Barry
Guessing from the sounds of it he is like our dba. He wants ids to be generated in order no matter what and not to skip any if something happens like a transaction failure. Our dbs have a special table in them called next_id. This table has 1 row and a column for each table with an id generated

[nhusers] Re: Difficult DBA

2009-05-26 Thread Tuna Toksoz
Use HiLo if possible, convince him this is the best way, or use guid.comthat creates less index fragmentation. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, May 27, 2009 at 12:01 AM, allan.ri

[nhusers] Re: Difficult DBA

2009-05-26 Thread Fabio Maulo
MAX ? very faster no? especially because is need a lock. 2009/5/26 allan.ritc...@gmail.com > > Unique identifiers are also considered the devil since they apparently > don't replicate (which I've never heard of) and they are slow. > guid.comb is extremely efficient but he wouldn't hear anymore a

[nhusers] Re: Difficult DBA

2009-05-26 Thread Andy Hitchman
A little OT, but possibly informative. I was recently doing some work with DB2. Everything was great in the Systest environment, but when we hit Prod we suddenly got thousands of additional Name records in our results sets---all for same guy. Turns out the original DBAs (15 years ago) had decided

[nhusers] Re: Difficult DBA

2009-05-26 Thread allan.ritc...@gmail.com
Unique identifiers are also considered the devil since they apparently don't replicate (which I've never heard of) and they are slow. guid.comb is extremely efficient but he wouldn't hear anymore about it. The current insert sprocs do the following INSERT INTO Table(ID, SomeColumn) WITH(XLOCK) VA

[nhusers] Re: Difficult DBA

2009-05-26 Thread allan.ritc...@gmail.com
Actually, I almost like Markus' idea. Thanks for that. I think I could add a default to the column in the DB. I'm not sure how this would handle criteria queries Expression.IsNull(child.Parent) etc. A lazy load of a many-to-one would still load up the placeholder record which is not ideal. The

[nhusers] Re: Difficult DBA

2009-05-26 Thread Tuna Toksoz
* it isn't going to leave alot of gaps in the IDs. I offered him unique identifiers but we all know that didn't go anywhere.* why? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, May 26, 2009

[nhusers] Re: Difficult DBA

2009-05-26 Thread Greg Young
What *does* he want with ids if not hilo and not sequences or guids? Cheers, Greg On Tue, May 26, 2009 at 4:50 PM, allan.ritc...@gmail.com < allan.ritc...@gmail.com> wrote: > > 1) It would be nice to work with nullable datetimes in the code since > that is a "not set" scenario to object guys.

[nhusers] Re: Difficult DBA

2009-05-26 Thread allan.ritc...@gmail.com
1) It would be nice to work with nullable datetimes in the code since that is a "not set" scenario to object guys. I've already made the user type that converts to/from the DB. It is easy and clean and makes both parties happy. 3) oh he hasn't accepted it yet. The argument being that it leaves

[nhusers] Re: Is is posible to get the column's names of a table dinamically?

2009-05-26 Thread Fabio Maulo
The question is the same done in the Spanish group and the answer is the same.Resuming here IEntityPersister (ISessionFactoryImplementor)sessionFactory.GetEntityPersister(string entityName) where entityName is the FullName of your class to get values select e.id from Entity e (note "id" in lower c

[nhusers] Is is posible to get the column's names of a table dinamically?

2009-05-26 Thread Daniel García
I need to get a row with values and column's names (as if I use DataRow) quering with NHibernate. Im able to get a row in the form of Object[] but isn't enough: ISQLQuery query = session.CreateSQLQuery("SELECT * FROM " + _dataTable + " WHERE " + _dataColumn + "=?"); query.SetInt32(0, id_); query.

[nhusers] One to one mapping with composite keys

2009-05-26 Thread Nilson
Hello! I'm a newbie in this matter, and i'm starting to use nhibernate. I couldn't find any posts refering this. So i'm having some doubts... When you have a relation between two tables and one of the tables has two primary keys and the other only has one, does this mean we have a one to many re

[nhusers] One to one mapping with composite keys

2009-05-26 Thread Nilson
Hello! I'm a newbie in this matter, and i'm starting to use nhibernate. I couldn't find any posts refering this. So i'm having some doubts... When you have a relation between two tables and one of the tables has two primary keys and the other only has one, does this mean we have a one to many re

[nhusers] Re: Difficult DBA

2009-05-26 Thread Fabio Maulo
1) you don't need a custom user type (a DateTime had a value)2) you don't need a custom user type (assign string.Empty to the property in the Ctor) 3) Alleluia!!! a DBA accepting HighLow 4) here you really need to do something. Zero is a value and even if you can use not-found="ignore" NH will try

[nhusers] Re: Difficult DBA

2009-05-26 Thread Markus Zywitza
Create an instead-of-trigger that replaces null with 0 on relations and ignore missing records via configuration. -Markus 2009/5/26 allan.ritc...@gmail.com : > > I work with an extremely difficult SQL Server DBA that hates anything/ > everything that is not a stored procedure.    However, he's s

[nhusers] Difficult DBA

2009-05-26 Thread allan.ritc...@gmail.com
I work with an extremely difficult SQL Server DBA that hates anything/ everything that is not a stored procedure.However, he's started coming around and but has still placed the following constraints. 1) Dates must be small datetime and NON-nullable. Nullable dates are equal to 1900/1/1. Ea

[nhusers] Re: Connecting to multiple database servers

2009-05-26 Thread Fabio Maulo
two RDBMS = two sessionFactories 2009/5/26 Aaron Alexander > > I am working on some code that needs to publish (replicate) data > across multiple servers. I will retrieve information from a SQL > Server database. I then need to publish the information to multiple > Oracle databases. The data

[nhusers] Re: Stable version of NH

2009-05-26 Thread Fabio Maulo
MAMMON,-Who know me and who read my blog know that I respect Microsoft and I respect the coming soon EF4 but that is another matter. -Create a test case (note a TEST CASE not a patch to fix the problem) should not be need a high skill. -Defensive... who? when ? In my personal case I can't get def

[nhusers] Re: Loading objects with readonly state

2009-05-26 Thread Roger Kratz
If your real world case is more complex than your example (?), I would consider impl state pattern rather than your enum. << giving the object an initialization state>> IIRC - I've seen some example at nhforge how to use a parameterized ctor, but if you want to keep your design, it's seems a lo

[nhusers] Loading objects with readonly state

2009-05-26 Thread David Perfors
Hi, In my application I want to do the following: public enum State { Writable, Readonly } public class DomainObject { private string _name; public DomainObject() { } public int Id { get; private set; } public State State { get; set; } public string Name {

[nhusers] Re: Stable version of NH

2009-05-26 Thread MAMMON
I've been thinking a lot about this post. In the last 18 months I have used NHibernate a lot. The main product I develop where I am employed is an internal ordering system used by as many as 17,000 employees, and it uses NHibernate for the data access layer. It's not a HUGE project or an ENORMO

[nhusers] Connecting to multiple database servers

2009-05-26 Thread Aaron Alexander
I am working on some code that needs to publish (replicate) data across multiple servers. I will retrieve information from a SQL Server database. I then need to publish the information to multiple Oracle databases. The data structure in Oracle is different than in SQL Server but the data struct

[nhusers] Re: Help with optimizing loading of associations

2009-05-26 Thread Thomas Koch
Hi Roger - thank you for your reply. :-) I have only tried to use the Criteria API: var criteria = session.CreateCriteria(typeof(A)).Restrictions.IdEq (id); criteria.SetFetchMode("Manager.BList", FetchMode.Join); criteria.CreateAlias("Manager.BList","bl"); criteria.SetFetchMode("bl.CList", Fetc

[nhusers] Re: Help with optimizing loading of associations

2009-05-26 Thread eilensm
Hi Thomas, I had some problem with the use of fetch mode myself. My problem, as far as I remerber, was that I used fetch mode "join" with a HQL query. I understand the documentation that this is not supported: >>> NHibernate reference, p. 116 ... The fetch strategy defined in the mapping docume

[nhusers] Re: NHibernate validator and DI

2009-05-26 Thread Dario Quintana
On Tue, May 26, 2009 at 8:35 AM, Zihotki wrote: > > Is there any sample of using custom validators which depends on data > in database? For example a validator which checks whether the email of > user is unique. That I recall there isn't. But you can build your own custom validator and make the

[nhusers] Re: Is always a Foreign Key in the Collection table?

2009-05-26 Thread srinivas
yes ur right sorry for the futile question :( On May 26, 3:24 pm, Stefan Steinegger wrote: > What else should it be? > > On 26 Mai, 11:25, srinivas wrote: > > > > > Is   tag  always a Foreign Key in the Collection > > table?- Hide quoted text - > > - Show quoted text - --~--~-~--~~-

[nhusers] Re: Mapping question: single entity out of a collection ("primary user" of a company)

2009-05-26 Thread eilensm
Hi, if anyone is interested ... I implemented a solution mapping the collection with a where clause. Thus, the collection will hold exactly one item. >>> ... .. <<< The mapped class additionally provides a derived property which reads this single element from the collection. Th

[nhusers] Re: Help with optimizing loading of associations

2009-05-26 Thread Roger Kratz
You want to eager load some entities and their collections using joins on db side? As you mention, fetchmode.join (or join fetch in hql), should be the way to go. SetFetchMode("SomeCollection", FetchMode.Join) If you have misspelled "SomeCollection" or not using the mapped prop name, you will

[nhusers] Help with optimizing loading of associations

2009-05-26 Thread Thomas Koch
Hello everyone. I want to optimize the loading of data in my domain model. In the past I have used MultiCriteria to load data from different tables "in one go" to the database. However, is it possible to use something similar to MultiCriteria to have NHibernate load an entity and its associatio

[nhusers] NHibernate validator and DI

2009-05-26 Thread Zihotki
Hello all, Is there any sample of using custom validators which depends on data in database? For example a validator which checks whether the email of user is unique. And is this possible to use dependency injector with validators? Thanks in advance. --~--~-~--~~~---

[nhusers] Re: Is always a Foreign Key in the Collection table?

2009-05-26 Thread Stefan Steinegger
What else should it be? On 26 Mai, 11:25, srinivas wrote: > Is   tag  always a Foreign Key in the Collection > table? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send emai

[nhusers] Re: NH2.1.0Alpha3

2009-05-26 Thread John Rayner
Many thanks to you and all the other contributors for these releases! Cheers, John On May 24, 9:52 pm, Fabio Maulo wrote: > Few minutes ago NH2.1.0Alpha3 was released. > > -- > Fabio Maulo --~--~-~--~~~---~--~~ You received this message because you are subscribed

[nhusers] Is always a Foreign Key in the Collection table?

2009-05-26 Thread srinivas
Is tag always a Foreign Key in the Collection table? --~--~-~--~~~---~--~~ 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, s

[nhusers] Re: Type mismatch in NHibernate.Criterion.SimpleExpression

2009-05-26 Thread kongxiangxin
I got it. the problem is my ReturnType is not correct. ReturnType should be: public virtual Type ReturnedType { get { return typeof( CodeText ); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl