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: Beginner question with JetDialect
PostPosted: Thu Nov 02, 2006 4:21 am 
Newbie

Joined: Thu Nov 02, 2006 4:04 am
Posts: 6
I hope there's enough infomation here. I think my invalid sql is due to "this_" in the statement. What caused this? This is a very simple test based on the quick start with with my own table.


Hibernate version: 1.2.0beta1

Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="wintest2003" namespace="wintest2003">
    <class name="wintest2003.tblCHAR, wintest2003" table="tblCHAR">
        <id name="CID">
            <generator class="assigned" />
        </id>
        <property name="CharName" column="CharName" type="String" length="50"/>
        <property name="Notes" type="String"/>
        <property name="ParentChar"/>
    </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
            Configuration cfg = new Configuration();
            cfg.AddAssembly("wintest2003");
       
            ISessionFactory factory = cfg.BuildSessionFactory();
            ISession session = factory.OpenSession();
            ITransaction transaction = session.BeginTransaction();

            IList charList = session.CreateCriteria(typeof(tblCHAR)).List();
            foreach(tblCHAR item in charList)
            {
                System.Diagnostics.Debug.WriteLine(item.CID + ": " + item.CharName);
            }
       
            session.Close();


Full stack trace of any exception that occurs:
Code:
nhibernate.dll!NHibernate.Impl.SessionImpl.Find(NHibernate.Impl.CriteriaImpl criteria = {NHibernate.Impl.CriteriaImpl}, System.Collections.IList results = {Count=0}) Line 5049   C#
   nhibernate.dll!NHibernate.Impl.SessionImpl.Find(NHibernate.Impl.CriteriaImpl criteria = {NHibernate.Impl.CriteriaImpl}) Line 4990   C#
   nhibernate.dll!NHibernate.Impl.CriteriaImpl.List() Line 300 + 0xd bytes   C#
>   wintest2003.exe!wintest2003.CharForm_nhibernate.CharForm_nhibernate_Load(System.Object sender = {wintest2003.CharForm_nhibernate}, System.EventArgs e = {System.EventArgs}) Line 59 + 0x36 bytes   C#
   [<Non-user Code>]   
   wintest2003.exe!wintest2003.Program.Main() Line 38   C#



Name and version of the database you are using:
Access 2003 SP2

The generated SQL (show_sql=true):
SELECT this_.CID as CID0_0_, this_.CharName as CharName0_0_, this_.Notes as Notes0_0_, this_.ParentChar as ParentChar0_0_ FROM tblCHAR this_

Debug level Hibernate log excerpt:
NHibernate.Impl.SessionFactoryObjectFactory: 2006-11-02 01:14:22,522 [3816] INFO NHibernate.Impl.SessionFactoryObjectFactory - no name configured
NHibernate.Loader.Loader: 2006-11-02 01:14:22,903 [3816] INFO NHibernate.Loader.Loader - FROM tblCHAR this_
NHibernate.SQL: 2006-11-02 01:14:22,913 [3816] DEBUG NHibernate.SQL - FROM tblCHAR this_
NHibernate.Util.ADOExceptionReporter: 2006-11-02 01:14:24,605 [3816] WARN NHibernate.Util.ADOExceptionReporter - System.Data.OleDb.OleDbException: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at NHibernate.JetDriver.JetDbCommand.System.Data.IDbCommand.ExecuteReader() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate.JetDriver\JetDbCommand.cs:line 129
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Impl\BatcherImpl.cs:line 182
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1282
NHibernate.Util.ADOExceptionReporter: 2006-11-02 01:14:24,625 [3816] ERROR NHibernate.Util.ADOExceptionReporter - Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
NHibernate.Util.ADOExceptionReporter: 2006-11-02 01:14:24,636 [3816] WARN NHibernate.Util.ADOExceptionReporter - System.Data.OleDb.OleDbException: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at NHibernate.JetDriver.JetDbCommand.System.Data.IDbCommand.ExecuteReader() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate.JetDriver\JetDbCommand.cs:line 129
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Impl\BatcherImpl.cs:line 182
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1296
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 395
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 183
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1646
NHibernate.Util.ADOExceptionReporter: 2006-11-02 01:14:24,646 [3816] ERROR NHibernate.Util.ADOExceptionReporter - Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
An unhandled exception of type 'NHibernate.ADOException' occurred in nhibernate.dll

Additional information: could not execute query[SQL: SELECT this_.CID as CID0_0_, this_.CharName as CharName0_0_, this_.Notes as Notes0_0_, this_.ParentChar as ParentChar0_0_ FROM tblCHAR this_]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 1:15 pm 
Newbie

Joined: Thu Nov 02, 2006 4:04 am
Posts: 6
I just tried the same code but changed the references to the nhibernate 1.0.2.0 dlls. It worked correctly with no errors.


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.