-->
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.  [ 6 posts ] 
Author Message
 Post subject: Extra periods in generated SQL from clause
PostPosted: Sun Jan 01, 2006 1:21 am 
Newbie

Joined: Sun Jan 01, 2006 1:16 am
Posts: 5
I am getting extra periods generated in the from clause on SQLite. The generated sql looks like this (notice the from .farm and join .notes):

2005-12-31 17:39:17,375 [4328 ] DEBUG NHibernate.SQL - SELECT this.farm_id as farm_id1_, this.update_date as update_14_1_, this.note_id as note_id1_, this.address as address1_, this.address2 as address21_, this.ssn as ssn1_, this.city as city1_, this."state" as y11_1_, this.farm_num as farm_num1_, this.zip as zip1_, this.create_date as create_13_1_, this.owner_type as owner_type1_, this.tax_id as tax_id1_, this.operator_name as operator3_1_, this.rent_type as rent_type1_, note1_.note_id as note_id0_, note1_.update_date as update_d4_0_, note1_.notes as notes0_, note1_.create_date as create_d3_0_ FROM .farm this left outer join .notes note1_ on this.note_id=note1_.note_id WHERE 1=1
2005-12-31 17:39:17,375 [4328 ] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2005-12-31 17:39:17,421 [4328 ] DEBUG NHibernate.Impl.BatcherImpl - Opened Reader, open Readers :1
2005-12-31 17:39:17,421 [4328 ] DEBUG NHibernate.Loader.Loader - processing result set
2005-12-31 17:39:21,468 [4328 ] DEBUG NHibernate.Util.ADOExceptionReporter - SQL Exception
Finisar.SQLite.SQLiteException: near ".": syntax error
at Finisar.SQLite.sqlite3.Throw()

I have never seen this before. Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 8:46 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
I've certainly seen wierd SQL generated when an HQL query is malformed. Can you post the HQL?

Cheers,

Symon,


Top
 Profile  
 
 Post subject: Malformed HQL
PostPosted: Sun Jan 01, 2006 9:57 am 
Newbie

Joined: Sun Jan 01, 2006 1:16 am
Posts: 5
The method that throws this error is simply:

ISession session = NHibUtil.Session;
IList farmList = session.CreateCriteria(typeof(Farm)).List();

table farm is related to table notes. When I remove the periods before the table names in the from clause it works just fine.


Top
 Profile  
 
 Post subject: Sql Server the Same
PostPosted: Sun Jan 01, 2006 10:10 am 
Newbie

Joined: Sun Jan 01, 2006 1:16 am
Posts: 5
I tried this with SQL Server, and am getting the same thing. This is very strange.

2006-01-01 07:07:31,437 [4312 ] DEBUG NHibernate.Impl.BatcherImpl - Building an IDbCommand object for the SqlString: SELECT this.farm_id as farm_id1_, this.update_date as update_14_1_, this.note_id as note_id1_, this.address as address1_, this.address2 as address21_, this.ssn as ssn1_, this.city as city1_, this.[state] as y11_1_, this.farm_num as farm_num1_, this.zip as zip1_, this.create_date as create_13_1_, this.owner_type as owner_type1_, this.tax_id as tax_id1_, this.operator_name as operator3_1_, this.rent_type as rent_type1_, note1_.note_id as note_id0_, note1_.update_date as update_d4_0_, note1_.notes as notes0_, note1_.create_date as create_d3_0_ FROM .farm this left outer join .notes note1_ on this.note_id=note1_.note_id WHERE 1=1
2006-01-01 07:07:31,437 [4312 ] INFO NHibernate.Loader.Loader - SELECT this.farm_id as farm_id1_, this.update_date as update_14_1_, this.note_id as note_id1_, this.address as address1_, this.address2 as address21_, this.ssn as ssn1_, this.city as city1_, this.[state] as y11_1_, this.farm_num as farm_num1_, this.zip as zip1_, this.create_date as create_13_1_, this.owner_type as owner_type1_, this.tax_id as tax_id1_, this.operator_name as operator3_1_, this.rent_type as rent_type1_, note1_.note_id as note_id0_, note1_.update_date as update_d4_0_, note1_.notes as notes0_, note1_.create_date as create_d3_0_ FROM .farm this left outer join .notes note1_ on this.note_id=note1_.note_id WHERE 1=1


INSERT INTO .farm (update_date, note_id, address, address2, ssn, city, [state], farm_num, zip, create_date, owner_type, tax_id, operator_name, rent_type) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13); select SCOPE_IDENTITY()


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 10:51 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Do you have anything like default-schema or just schema set? What does your mapping look like?


Top
 Profile  
 
 Post subject: SUCCESS!!!
PostPosted: Sun Jan 01, 2006 11:58 am 
Newbie

Joined: Sun Jan 01, 2006 1:16 am
Posts: 5
That's it!! I have been working with Oracle lately, and my mapping file still had a schema= tag in it. I modified the templates and VIOLA!!

OLD:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="">

NEW:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">

Thanks all for your help!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.