Search Results

Search found 1672 results on 67 pages for 'nhibernate'.

Page 24/67 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Nhibernate - How to get rid of unwanted text cast

    - by Nicolas Cornu
    Hello, I am using Nhibernate 2 and PostgreSql The above code generate a query with a cast on expression res = _session.CreateCriteria(typeof(C)) .Add(Restrictions.Eq("Exp", Exp)) .AddOrder(new Order("Fr", false)) .SetMaxResults(MW) .List<C>(); Exp is a character varying(30) In the query: SELECT ... FROM table WHERE Exp = 'text':: text ... I want to get rid of cast 'text":: text beacause the index is not used. Nicolas

    Read the article

  • common problem with Hibernate/NHibernate and child IDs

    - by tyndall
    I'm asking both Hibernate and NHibernate groups because I'm thinking this may be a common issue seen on both. What does it usually mean when you call a saveOrUpdate on a child object and... 1) If it is an insert everything works fine. 2) If it is an update its wiping out the parent ID in the database.

    Read the article

  • NHibernate & WCF in version 3.0

    - by ChrisKolenko
    Hi everyone :D I've just started a new project which requires a WCF service to handle a distributed environment. I'm still trying to find the best way to implement things. I want to use NHibernate, but I've seen a few different ways to address the serialization. Is this handled in 3.0? I noticed wcf_context inside the truck :D If it isn't handled could someone point me in the right direction? Thanks everyone

    Read the article

  • NHibernate complex one-to-one mapping

    - by Eugene Strizhok
    There is a table A containing common unversioned data for entities. There are also tables B,C,D with versioned data of particular entity type. All of these tables are referencing table A. The task is to add a mapping of a property of entity's type, for example, stored in table B, which would reference table A, and specify a rule how entity should be fetch from table B based on identifier from table A. (For example, to fetch latest version of an entity). It it possible with NHibernate?

    Read the article

  • Using NHibernate to map a nChar column to an enumerated type

    - by Morrislgn
    Hello Folks, I am trying to map a table frp, a SQL Server 2005 DB to a class which contains an enum: public class MyClass{ private YesNoOptional addressSetting; public YesNoOptional AddressSetting{ {get; set;} } } public enum YesNoOptional { Yes, No, Optional } This will dictate that one of three values is inserted into the corresponding column - 'Y', 'N', 'O'. This column is of type nchar(1). My mapping file is like so (addressSetting is the property which is causing the problem): <class name="IncidentDefinition" table="IR_INCIDENT_DEF" lazy="false" > <id name="Guid" column="INT_GUID" > <generator class="guid"></generator> </id> <property name="Reference" column="INT_REF" ></property> <property name="Description" column="INT_DESCRIPTION" ></property> <property name="AddressSetting" column="INT_ADDRESS_REQ" ></property> <property name="Active" column="INT_ACTIVE" type="YesNo"></property> <property name="PinDocId" column="INT_PIN_DOC_ID"></property> </class> Using the config above I get the following error: NHibernate.ADOException: could not initialize a collection: System.FormatException: Input string was not in a correct format.. If I try to map the enum using a custom type like so: <property name="AddressSetting" column="INT_ADDRESS_REQ" type="ML.Types.YesNoOptional, ML.Types" ></property> Error: System.FormatException: Input string was not in a correct format. Next, if I try using a specific type like so: <property name="AddressSetting" column="INT_ADDRESS_REQ" type="String" ></property> This error is generated: NHibernate.PropertyAccessException: The type System.String can not be assigned to a property of type System.ArgumentException: Object of type 'System.String' cannot be converted to type 'ML.Types.YesNoOptional'.. As a last resort I tried to specify the type as a char like so: <property name="AddressSetting" column="INT_ADDRESS_REQ" type="Char" ></property> This works a bit better, as it in it doesnt throw an error, however instead of returning the character from the table and mapping it to the enumerated type the ASCII value of the character is returned instead - so Y is represented by 89! I am hoping someone can explain what I am doing wrong and\or how why this is happening please? Thanks Morris

    Read the article

  • Criteria SpatialRestrictions.IsWithinDistance NHibernate.Spatial

    - by idjones82
    Has anyone implemented this, or know if it would be difficult to implement this/have any pointers? public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance) { // TODO: Implement throw new NotImplementedException(); } from NHibernate.Spatial.Criterion.SpatialRestrictions I can use "where NHSP.Distance(PROPERTY, :point)" in hql. But want to combine this query with my existing Criteria query. for the moment I'm creating a rough polygon, and using criteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon));

    Read the article

  • How to clear the entire second level cache in NHibernate

    - by Bittercoder
    I wish to clear the entire second level cache in NHibernate via code. Is there a way to do this which is independent of the cache provider being used? (we have customers using both memcache and syscache within the same application). We wish to clear the entire cache because changes external the database would have occurred (which we have no guarantees re: which tables/entities were affected).

    Read the article

  • NHibernate criteria construction

    - by brianberns
    I am trying to recreate something like the following SQL using NHibernate criteria: select Range, count(*) from ( select case when ent.ID between 'A' and 'N' then 'A-M' else 'Other' end as Range from Subject ) tbl group by tbl.Range I am able to create the inner select as follows: session.CreateCriteria<Subject>() .SetProjection( Projections.Conditional( Expression.Between("Name", "A", "N"), Projections.Constant("A-N"), Projections.Constant("Other"))) .List(); However, I can't figure out how to pipe those results into a grouping by row count. Any suggestions? Thanks. -- Brian

    Read the article

  • NHibernate dateTime as an ID Bad idea?

    - by Miau
    hi there I have an entity and it seems like using DateTime as the Id would be a good suit, however I there is this strange feeling that that it might be a terrible idea ( tho i cant come up with any logical reason as to why), This is an immutable object ( ie once the value is recorded it shouldn't really change ) So DateTime as id field in NHibernate yay or Nay? I would appreciate your comments on this

    Read the article

  • NHibernate Query

    - by Nathan Roe
    Is it possible to get NHibernate to generate a query similar to the following with HQL or Criteria API? select * from ( select row_number() over ( partition by Column1 order by Column2 ) as RowNumber, T.* from MyTable T ) where RowNumber = 1 I can get it to execute the inner select using the formula attribute, but I can't figure out a way to write a HQL or Criteria query that lets me wrap the inner select in the outer one.

    Read the article

  • SQLite connection pooling with Fluent NHibernate

    - by Groo
    Is there a way to setup SQLite connection pooling using Fluent NHibernate configuration? E.g. equivalent of DataSource=:memory: would be: var sessionFactory = Fluently .Configure() .Database(SQLiteConfiguration.Standard.InMemory) (etc.) Is there something eqivalent to "Pooling=True;Max Pool Size=1;"?

    Read the article

  • NHibernate with StructureMap for a Non-Web Application

    - by Yoann. B
    Hi, What is best pratices for inject and manage Session/Transaction for NHibernate using StructureMap for a Non Web Application like an Windows Service ? In a web context, we use PerRequest Session management lifecycle using the Hybrid Lifecycle of StructureMap but for a Windows Service, i can't handle IDisposable UnitOfWork ... Thanks.

    Read the article

  • How do I map common properties in NHibernate

    - by Ian Oakes
    In the database I'm working with, every table repeats the same nine columns and I don't want to have to supply the same properties in each of my entities to map these columns. I've tried adding properties to a common base class and adding them to the sub class's mapping file, but this doesn't work. I've read the documentation around inheritance mapping but this did not help. What is the best way to map columns that repeat accross multiple tables in NHibernate?

    Read the article

  • NHibernate Left Outer Join

    - by Matthew
    I'm looking to create a Left outer join Nhibernate query with multiple on statements akin to this: SELECT * FROM [Database].[dbo].[Posts] p LEFT JOIN [Database].[dbo].[PostInteractions] i ON p.PostId = i.PostID_TargetPost And i.UserID_ActingUser = 202 I've been fooling around with the critera and aliases, but I haven't had any luck figuring out how do to this. Any suggestions?

    Read the article

  • NHibernate: inserting additional calculated column

    - by Andrey Shchekin
    What would be your approach with NHibernate to do the following: When Comment is inserted into DB, and its property Text is inserted into column Text (due to a mapping), insert into column TextHash a hash of this property value. It seems trivial if I map TextHash, but how should I do this without mapping it? I do not need it in the domain model, its a DB-level optimization (I would use computed HashBytes if not for the length limit).

    Read the article

  • Using NHibernate to insert/update using a SQL server-side DEFAULT value

    - by Joseph Daigle
    Several of our database tables contain LastModifiedDate columns. We would like these to stay synchronized based on a single time-source. Our best time-source, in this case, is the SQL Server itself since there is only one database server but multiple application servers which could potentially be off sync. I would like to be able to use NHibernate, but have it use either GETUTCDATE() or DEFAULT for the column value when updating or inserting rows on these tables. Thoughts?

    Read the article

  • versioning in Fluent NHibernate

    - by csetzkorn
    In my NHibernate mapping files I used: <version name="Version" column="Version" /> to implement versioning. How do I achieve this using fnhibernate? What should go in here? public class blaMap : IAutoMappingOverride<bla> { public void Override(AutoMapping<bla> mapping) { ???? } } thanks. christian

    Read the article

  • NHibernate mapping in Asp.Net using MySql

    - by Siva
    Hi, I'm new to NHibernate. Actually I'm trying to save the values ffrom two text boxes into MySql Database in asp.Net page. I that I got "Resource not found: WebApplication1.Sample.hbm.xml" error. But I can't fix this error. Can anyone help me to fix this one?

    Read the article

  • NHibernate : recover session after connection lost

    - by Catalin DICU
    I'm using NHibernate with SQL Server 2005 in a WPF client application. If I manually stop the SQL Server service and then restart it the session doesn't automatically reconnect. So far I'm doing this witch seems to work : try { using (ITransaction transaction = this.Session.BeginTransaction()) { // some select here } }catch(Exception ex) { if(this.Session.Connection.State == ConnectionState.Closed) { try { this.Session.Connection.Open(); } catch (Exception) { } } } Is there a better way ?

    Read the article

  • Visual NHibernate from Slyce

    - by dotnetdev
    I found this tool Visual NHibernate at http://www.slyce.com/, but a search on here has not brought anything up for what I would have thought would have been a very popular product, in concept anyway. Has anyone used this product? Any feedback on it? Thanks

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >