-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: GenericADOException was unhandled: could not insert
PostPosted: Tue Jan 12, 2010 4:01 pm 
Newbie

Joined: Fri Jan 08, 2010 1:04 pm
Posts: 2
I am going through a tutorial and I am getting this error. on the session.save()

could not insert: [HelloNHibernate.Employee][SQL: INSERT INTO Employee (name, manager) VALUES (?, ?); select SCOPE_IDENTITY()]

I have no idea how to resolve this. If you can help please do.
here is my hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    auto-import="true">
  <class name="HelloNHibernate.Employee, HelloNHibernate" lazy="false">
    <id name="id" access="field">
      <generator class="native" />
    </id>
    <property name="name" access="field" column="name"/>
    <many-to-one access="field" name="manager" column="manager" cascade="all"/>
  </class>
</hibernate-mapping>



here is my app.config
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory>
      <property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>
      <property name="connection.driver_class">
        NHibernate.Driver.SqlClientDriver
      </property>
      <property name="connection.connection_string">
        Data Source=10.0.0.15;Initial Catalog=webtables;Persist Security Info=True;User ID=user;Password=password
      </property>
      <property name="dialect">
        NHibernate.Dialect.MsSql2000Dialect
      </property>
      <property name="show_sql">
        false
      </property>
      <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

    </session-factory>
  </hibernate-configuration>
</configuration>


Top
 Profile  
 
 Post subject: Re: GenericADOException was unhandled: could not insert
PostPosted: Wed Jan 13, 2010 3:35 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Is there an inner exception with more details ?

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.