-->
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.  [ 1 post ] 
Author Message
 Post subject: Error: can't insert
PostPosted: Thu May 31, 2007 5:30 am 
Newbie

Joined: Thu May 31, 2007 4:53 am
Posts: 7
Hibernate version:1.0.2.0
Code between sessionFactory.openSession() and session.close():
Code:
ITransaction tx = null;
            try
            {
                if (!session.IsConnected)
                {
                    session.Reconnect();
                }
                Object result;
                tx = session.BeginTransaction();
                result = session.SaveOrUpdateCopy(obj);
                session.Flush();
                tx.Commit();
                return result;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);

                if (tx != null)
                    tx.Rollback();
                throw ex;
            }



Full stack trace of any exception that occurs:
could not insert: [NHibernateTest.TestClass#0]


Name and version of the database you are using:MSSQL express obtained with VS2005

The generated SQL (show_sql=true):
?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHibernateTest.TestClass, NHibernateTest" table="TestClasses">
<!-- map the id field -->
<id name="Id" column="Route_ID" type="int">
<generator class="assigned" />
</id>
<property name="Name" column="Name" type="String"/>
<property name="Layout" column="Layout" type="String"/>
<property name="Frequency" column="Frequency" type="int"/>
</class>
</hibernate-mapping>


But it does not work correctly. Exception "Can't insert" is appeared.
How can I resolve this problem?


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

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.