I am trying to get a list of Products that share the Category.
NHibernate returns no product which is wrong.
Here is my Criteria API method :
public IList<Product> GetProductForCategory(string name)
{
return _session.CreateCriteria(typeof(Product))
.CreateCriteria("Categories")
.Ad...
i found an error whenever i am calling oracale stordeprocedure from class using isession
this is my mappping file
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2" default-access="field"
assembly="DataContext" namespace="DataContext" >
<sql-query name="GetEmployeedetails" callable="true">
<return alias="emp" class="empdeta...
I am new to NHibernate and have just started right now.
I have very simple table contain Id(Int primary key and auto incremented), Name(varchar(100)), Description(varchar(100))
Here is my XML
<class name="DevelopmentStep" table="DevelopmentSteps" lazy="true">
<id name="Id" type="Int32" column="Id">
</id>
<property name="Name" column="...
I have 2 tables having many to many relation and hence there is junction table to resolve this
like... Table1, Table2 and Junction table name Table1Table2 having Foreign key of Table1 and Table2 and both are composit key
here is what I am doing and getting exception
<class name="Table1Table2" table="Table1Table2" lazy="true">
<many-to...
Hi all, I have map the entities in .hmb.xml and define attribute for all entity in classes.
I have some basic accomplishment and get all the record using below code.
public List<DevelopmentStep> getDevelopmentSteps()
{
List<DevelopmentStep> developmentStep;
developmentStep = Repository.FindAll<DevelopmentStep>(new Orde...
Hi,
I have two databases. One from Oracle 10g. Another from Mysql. I have configured my web application with Nhibernate for Oracle and now I am in need of using the MySQL database. So how can i configure the hibernate.cfg.xml so that i can use both of the database at the same application?
My current hibernate.cfg.xml is:
<?xml versio...
I'm fairly new to NHibernate, and I need to ask a couple of questions relating to a very frequent scenario. The following simplified example illustrates the problem.
I have two tables named Equipment and Users. Users is a set of system administrators. Equipment is a set of machinery.
Tables:
Users table has UserId int and LoginName n...
My project needs to handle three databases, that means three session factories. The thing is if i do something like this with fluent nhibernate:
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
the factories would pick up all the mappings, even the ones that correspond to another database
I've seen th...
I'm testing support for encrypted connections from my client application to my SQL server using SSL. I've setup my test certificate and added "encrypt=true" to my connection string and everything is working fine.
If I connect to my SQL server using Management Studio I can view the connection properties and verify that yes, the connectio...
I have a TrackLog that has a collection of TrackPoints:
public class TrackLog
{
public string Name { get; set; }
public ISet<TrackPoint> TrackPoints { get; set; }
}
public class TrackPoint
{
public DateTime Timestamp { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
}
I'd lik...
How can I write a criteria to return all Orders that belong to a specific User?
public class User
{
[PrimaryKey]
public virtual int Id { get; set; }
}
public class Order
{
[PrimaryKey]
public virtual int Id { get; set; }
[BelongsTo("UserId")]
public virtual User User { get; set; }
}
return ActiveRecordMediator<Order>.Fin...
This really puzzled for hours, I searched all over the internet, but got no working solution. Can someone point where the problem is ... thanks !
I created my own dialect class
public class MySQLDialectExtended : MySQLDialect
{
public MySQLDialectExtended()
{
RegisterFunction("date_add_interval", new SQLFunctionTemplate(...
Why Nibernate HQL can not handle the following query:
from Deal D where (D.ApprovalDate + INTERVAL 1 Year) < current_timestamp() < (D.RenewalDate + INTERVAL -1 Year)
knowing that INTERVAL and YEAR are keywords in MySQL, so this is kind of mixing Sql within Hql (unless Hql can handle date functions like so and I don't know) . The dia...
Hi.I'm trying to write a web page in .NET, using C# and NHibernate 2.1.
The pertinent code looks like this:
var whatevervar = session.CreateSQLQuery("select thread_topic, post_time, user_display_name, user_signature, user_avatar, post_topic, post_body from THREAD, [USER], POST, THREADPOST where THREADPOST.thread_id=" + id + " and THRE...
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 ha...
Hi all, in my goal to adopt better coding practices I have a few questions in general about automatic handling of code. I have heard different answers both from online and talking with other developers/programmers at my work. I am not sure if I should have split them into 3 questions, but they all seem sort of related:
1) How does .NET ...
I have this table structure and would like to map it using Fluent Hibernate (subclass if possible). I cannot change the structure because the database has too many records and might cause major applications rework. It would be easier if the Id from Party table was a foreign key in person and organization table, but in the particular scen...
The problem here consists of translating a statement written in LINQ to SQL syntax into the equivalent for NHibernate. The LINQ to SQL code looks like so:
var whatevervar = from threads in context.THREADs
join threadposts in context.THREADPOSTs
on threads.thread_id equals threadposts...
I am working on improving the performance of DataAccess Layer of an existing Asp.Net Web Application. The scenerios are.
Its a web based application in Asp.Net.
DataAccess layer is built using NHibernate 1.2 and exposed as WCF Service.
The Entity class is marked with DataContract.
Lazy loading is not used and because of the eager-fetch...
I have some big entities which are frequently accessed in the same session. For example, in my application there is a reporting page which consist of dynamically generated chart images. For each chart image on this page, the client makes requests to corresponding controller and the controller generates images using some entities.
I can ...