NHibernate Mapping Method - Invalid Object Name Employee?
May 10, 2010
I am trying to configure NHibernate on my console application in which I am trying to map an Employee class to a table Employee.I am getting below exception which I have no clue:
Class:
class Employee
{
public int id;
public string name;
[code]...
View 3 Replies
Similar Messages:
Apr 30, 2010
I have a dropdown list on an ASP.NET MVC project that I am pretty sure is not binding to my model because of my nhibernate mapping. I have tried many variations on the asp mvc side resulting in this post here.
MVC side of things seems fine I believe the issue may be that my object is trying to bind, but my mapping is out of whack.
My mapping is:
<many-to-one name="Project" lazy="false"
class="AgileThought.ERP.Domain.Property.Project"
column="ProjectGUID" />
My View gives an error saying that the GUID from the dropdownList selected value is not valid. Which I think may be that it is trying to push the GUID into my related project object.
The value 'fd38c877-706f-431d-b624-1269184eeeb5' is invalid.
My related project list binds to the dropdown list just fine, it is just not binding to my models Project entity.
View 1 Replies
Feb 18, 2010
with fluent nhibernate, is there a way to dynamically switch the table of a mapping at runtime?
public class XYClassMap : ClassMap<XY>
{
public XYClassMap( )
{
Table("XYTable");
Id(d => d.Id).GeneratedBy.Identity();
Map(d => d.Value);
[code]...
View 2 Replies
Feb 2, 2010
I'm working on a RoleProvider in .NET, using Fluent NHibernate to map tables in an Oracle 9.2 database.
The problem is that the many-to-many table connecting users and roles uses a primary key generated from a sequence, as opposed to a composite key. I can't really change this, because I'm writing it to be implemented in a larger existing system.
Here is my UserMap:
public UserMap()
{
this.Table("USR");[code].....
Yet, this is giving me the error:
Type 'FluentNHibernate.Cfg.FluentConfigurationException' in assembly 'FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880' is not marked as serializable.
Is there a simple fix to allow this HasMayToMany to use my PersistentObjectMap extension? I'm thinking I may have to add a convention for this many-to-many relationship, but I don't know where to start with that, since I've just started using NHibernate and Fluent NHibernate only recently.
EDIT: I think I've found a possible solution here: http://marekblotny.blogspot.com/2009/02/fluent-nhbernate-and-collections.html
I'll try the above method of creating an entity and a class map for the linking table and post my findings.
EDIT 2: I created a linking entity as mentioned in the above blog post and downloaded the newest binaries (1.0.0.623).
This helped me discover that the issue was with setting lazy load and trying to add roles to the user object in a completely new session.
I modified the code to move OpenSession to the BeginRequest of an HttpModule as described here. After doing this, I changed my data access code from wrapping the open session in a using statement, which closes the session when it is finished, to getting the current session and wrapping only the transaction in a using statement.
This seems to have resolved the bulk of my issue, but I am now getting an error that says "Could not insert collection" into the USR_ROLE table. And I'm wondering if the above code should work with a UserRoleMap described as:
public UserRoleMap()
{
this.Table("USR_ROLE"); [code]....
Hibernate's documentation for many-to-many relationship suggests creating an object to maintain a one-to-many/many-to-one, as in an ERD. I'm sure this would be much easier with conventional naming standards, but I have to stick with certain abbreviations and odd (and not always properly-implemented) conventions.
View 1 Replies
Nov 19, 2010
I am having a problem mapping a many-to-one relationship from an abstract base class mapping to a concrete union-subclass. Example:
public abstract class Entity
{
public virtual Guid ID {get; set;}
public virtual string Name {get;set;}
public virtual User OwnerUser {get; set;}
}
public class User : Entity
{
public virtual string UserName {get; set;}
}
I have a base abstract class for all of my database objects. I am mapping these classes with the Entity class as the abstract mapping class and the User as a union-subclass. When creating the configuration object, no errors are thrown and the Schema exports just fine. However, the field to the OwnerUser just won't show up in the database for all of the concrete classes. Here is an example of how the mapping looks
<class entity-name="Entity" name="Entity" abstract="true">
<id name="ID" type="guid">
<generator class="guid.comb"/>
</id>
<property name="Name" />
<many-to-one name="OwnerUser" column="ID" entity-name="User" />........
I am also using an Oracle XE instance as the database backend. If this isn't enough information to properly answer the question, let me know and I will add what I can.
View 1 Replies
Sep 2, 2010
I want to bind data(For ex: Employee name, Employee ID from Employee) to a dropdownlist and the data should be displayed in dropdownlist as two columns. I don't want to separate this columns by using any special characters like | or '-'. I want to display them as different columns in a dropdownlist.
How can i achieve this using .net and the data i need to retrieve using SQL server 2008.
View 2 Replies
Aug 31, 2010
error Could not compile the mapping document: WebApplication1.documents.hbm.xml ![alt text][1] photo [URL]
web.config
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" .....
View 1 Replies
Sep 9, 2010
I'm trying to create a self referencing object using linqTOsql mapping. So far, I am definitely in over my head. Here's the code I have:
[Table]
public class Category
{
[Column(IsPrimaryKey=true, IsDbGenerated=true, AutoSync=AutoSync.OnInsert)]
public Int64 catID { get; set; }
public Int64 parentCatID { get; set; }
[code]...
View 2 Replies
Mar 2, 2011
this is the error i get
[Code]....
View 2 Replies
Aug 27, 2010
I am getting the following error in an Asp.Net Castle ActiveRecord app when trying to update an object:
"a different object with the same identifier value was already associated with the session"
I've looked up and down my code to see where else the object might have been created but I'm not seeing it. This is baffling as I have the exact same code on another page that works fine on updates
Now I'm thinking of trying to see where this other object is in the Session and either kill it or find out how it got into the session. How can I find this object?
[Update]
Ok, I finally found where the object is being called. However, I would still like to know how to find objects in the session for future reference.
View 1 Replies
Sep 15, 2010
I'm making the leap to move from vb.net to C#, and I'm getting this crazy error when I try to execute one sp, set a value, and then execute another sp based on the value. proc_GetSectionDetails is my first stored procedure. From that, I get a value for SectionID, and then use it for the second sp called proc_GetSectionDetails
[Code]....
View 2 Replies
Jun 7, 2010
I have a situation where I have 3 tables: StockItem, Office and StockItemPrice. The price for each StockItem can be different for each Office.
StockItem(
D
Name
)
Office(
ID
Name
)
[code]...
View 2 Replies
Sep 29, 2010
I have the following code:
[WebMethod]
[SoapHeader("_webServiceAuth")]
public User GetUser(string username){
try
{
this._validationMethods.Validate(_webServiceAuth);
User user = new User(username);
[code]...
View 1 Replies
Dec 22, 2010
I have embed the fullcalender control in my asp.net mvc application. It is running fine locally. but when I uploads it to my domain server (third party) it showing me This Error: Uncaught TypeError: Object # has no method 'fullCalendar' in crome console (debugger). and not rendering the control. ** EDITED: My HTML code is this **
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
Index
<% var serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); %>
< style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}..............................................
View 1 Replies
Jan 24, 2011
I'm following the ASP.Net MVC3 tutorial. When I'm in step [URL] I meet a problem with the SQLExpress and EFCodeFirst. In the step, the EFCodeFirst is expected to generate the database("Movies") and table ("dbo.Movies") automatically. But after I navigate to [URL] only the database ("Movies") was created, there's no "dbo.Movies" table inside at all. Here's the error stack:
Server Error in '/' Application.
Invalid object name 'dbo.Movies'.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Movies'.
Source Error:
[Code]....
Line 18: select m;Line 19: Line 20: return View(movies.ToList());Line 21: }Line 22: }
Source File: C:Users110285DocumentsVisual Studio 2010Projectsasp.net2011MvcMovieMvcMovieControllersMoviesController.cs Line: 20
Stack Trace:
[Code]....
[SqlException (0x80131904): Invalid object name 'dbo.Movies'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33 System.Data.SqlClient.SqlDataReader.get_MetaData() +86 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +443[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.] System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +479 System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +736 System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +149 System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44 System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator() +40 System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +315 System.Linq.Enumerable.ToList(IEnumerable`1 source) +58 MvcMovie.Controllers.MoviesController.Index() in C:Users110285DocumentsVisual Studio 2010Projectsasp.net2011MvcMovieMvcMovieControllersMoviesController.cs:20 lambda_method(Closure , ControllerBase , Object[] ) +96 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore() +116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
View 5 Replies
Jan 19, 2011
I uploaded all the files of Umbraco CMS to the my http://blog.domain.com and also modified the web.config file. When I point to blog.domain.com, it is giving an error written in the subject. The hosting type for the subdomain is physical hosting not subdomain on subfolder
So, I have a second web.config file in this subdomain. The first one is in the main domain. I hoep this doesnt make a differnce. Here's the screenshot: [URL]
I checked the database user with which I am trying to login in to the DB and it has the db_owner permissions for the database.
Also, I tried googling for the similar issues to see if someone with similar error had resolved the problem. Here are some pages but I haven't been able to find a solution.
View 1 Replies
Feb 5, 2011
I just installed IIS and .net on my machine. I am trying to run basic default.aspx. I keep getting error:
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
Module
StaticFileModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x80070001
Requested [URL]
Physical Path
C:inetpubwwwrootKobeTestDefault.aspx
Logon Method
Anonymous
Logon User
Anonymous
View 5 Replies
Jan 16, 2011
I created this sp just as my other sp's are created. I took an existing SP and I just modified the name of the sp for the new name. I changed the MODIFY word to CREATE and made the new procedure. All of them work when I execute the sp. Why is it when I open the sp to modify the line is underlined in red with Invalid Object Name. This is the case is each one. Select, SelectAll, Insert, Delete, and Upate. dbo is the ower of each one. I have checked the properties. Here is the code used to create:
[Code]....
View 7 Replies
Aug 20, 2010
I am trying to execute a CREATE TABLE which results in the following SQL exception:
Invalid object name 'UserLock'.
The statement looks like this:
USE [db]
GO
CREATE TABLE [db].[dbo].[UserLock] (
[Login] [varchar](150) NOT NULL,
[ExpirationDate] [datetime] NOT NULL,
CONSTRAINT [PK_UserLock] PRIMARY KEY CLUSTERED
([Login] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
The strange part is that I can run the query successfully inside the Microsoft SQL Management Studio with the same user but not within my .NET web application written in C#. I am not using any frameworks and I connect to the database with the provided classes out of System.Data.SqlClient. All other database queries work within the app. The database is Microsoft SQL Express 2005.
-- Edit ---
This is how my execution code looks like:
string createString = "CREATE TABLE [" + catalog + "].[dbo].[UserLock]("
+ " [Login] [varchar](150) NOT NULL,"
+ " [ExpirationDate] [datetime] NOT NULL,"
+ " CONSTRAINT [PK_UserLock] PRIMARY KEY CLUSTERED "
+ " ([Login] ASC)"
+ " WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]"
+ ") ON [PRIMARY]";
SqlCommand createCommand = connection.CreateCommand();
createCommand.Connection = connection;
createCommand.CommandText = createString;
selectCommand.ExecuteNonQuery();
I catch the exception in another method. The SQL connection itself is beeing set up in antoher method, aswell. It's the standard SqlConnection connection = new SqlConnection(connectionString);
View 3 Replies
May 18, 2010
I have created my function as follows
USE [fedach]
GO
/****** Object: UserDefinedFunction [dbo].[pages_Allowed] Script Date: 05/18/2010 14:14:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[pages_Allowed] (@username varchar(35))
RETURNS varchar(30) AS BEGIN -- Declare the return variable here DECLARE @pages varchar(30)
DECLARE @PRvalidate tinyint,@PRdownload tinyint,@PRupload tinyint, @Pages as varchar(35)
select @PRvalidate=Rvalidate,@PRdownload=Rdownload,@PRupload=Rupload from tblPermittedpages where Username=@username;
select @Pages = case
when @PRvalidate=1 and @PRdownload=1 and @PRupload=1
then 'Admin'
when @PRvalidate=1 and @PRdownload=0 and @PRupload=0
then 'Validate Only'
when @PRvalidate=0 and @PRdownload=1 and @PRupload=0
then 'Download Only'
when @PRvalidate=1 and @PRdownload=0 and @PRupload=0
then 'Validate and Download' End;
return @pages
END
But when i am running the function i am getting the error as Invalid object name 'dbo.pages_Allowed'. can any one tell why?
View 7 Replies
Nov 22, 2010
I tried to add a stored procedure to my already group of procedures. For example, I have link_delete, Link_insert, Link_update I need a way to insert a link and this must relax the constraints: I tried to create a Link_insert2 and the thing is underlined in red saying Invalid Object in my query window. I basically renamed the existing Link_Insert stored procedure and added the line:
ALTER TABLE tblLink DROP FOREIGN KEY FK_tblLinks_tblWebSite
because my program is not able to write to the table unless I do this. I was going to just forget the stored procedure altogether and use a sub which I did and is writing a row. It is not returning the SCOPE_IDENTITY however, and I must get that. Can someone tell me how to get that?
[Code]....
View 5 Replies
Dec 26, 2010
whan i create new table using sql express 2010 to an excisting database in sql server 2008 this error message comes
Invalid object name 'dbo.DrugsCaegory';
where DrugsCaegory is the new created table by sql express by visual studio 2010 it works correctly local but when run it on server this error message comes
note:all other tables was created by sql server 2008,but this new table creayed by express 2010
is this is the reason ???
but it works local ,
on local database is express version 2010
on server database sql server 2008
View 2 Replies
Dec 4, 2010
fetching data from 2 tables in one Stored Proceure..what's wrong with the SP below ?
Its giving error as "Msg 208, Level 16, State 6, Procedure sp_GetID, Line 9
Invalid object name 'Admin.sp_GetID'."
ALTER PROCEDURE GetID
(
@ID int [code]....
I am altering a previously made procedure...All I changed was ..I added the second SELECt statment...just that...otherwise SP was executing
View 2 Replies
Apr 15, 2010
I am using following code to encrypt and decrypt files. It works fine in windows application but shows an error in asp.net class. It's using Riijandael method.
Error : padding is invalid and cannot be removed
Code:Public Sub EncryptOrDecryptFile(ByVal strInputFile As String, _
ByVal strOutputFile As String, _
) [code]....
View 5 Replies
Dec 1, 2010
I'm trying to pass email addresses from an array to a stored procedure, then display the results in my gridview. I get the following error:No mapping exists from object type System.String[] to a known managed provider native type.On this line: Dim DR As SqlDataReader = MyCommand.ExecuteReader
[Code]....
View 4 Replies